Conversation
Notices
-
errante (errante@rot.gives)'s status on Thursday, 30-Mar-2023 21:37:43 JST errante @paulo @roboneko @Abby @node @driftwood @thatguyoverthere heres my confusion: if parseNaN obly accepts numerics, and it converts input to numerics, then surely '' shpuld be converted to its numeric equivalent - Disinformation Purveyor :verified_think: likes this.
-
Disinformation Purveyor :verified_think: (thatguyoverthere@shitposter.club)'s status on Thursday, 30-Mar-2023 21:37:43 JST Disinformation Purveyor :verified_think: @errante @roboneko @Abby @paulo @node @driftwood
isNaN will determine that some strings are not a number and some are
```
isNaN('5') // false
isNaN('nonsense') // true
``` -
Disinformation Purveyor :verified_think: (thatguyoverthere@shitposter.club)'s status on Thursday, 30-Mar-2023 21:43:45 JST Disinformation Purveyor :verified_think: @errante @roboneko @Abby @paulo @node @driftwood yeah before testing I would have expected isNaN(...) and isNaN(parseInt(...)) to behave similarly, but they do not in every case. Sometimes isNaN seems to determine that non-parsed strings look like numbers (isNaN('5') === false). To me the fact that an empty string literally parses to NaN but isn’t caught by isNaN is strange considering that isNaN('stringval') is correctly assessed.
-
Disinformation Purveyor :verified_think: (thatguyoverthere@shitposter.club)'s status on Thursday, 30-Mar-2023 21:46:45 JST Disinformation Purveyor :verified_think: @errante @Abby @driftwood @node @paulo @roboneko also the fact that parseInt will incorrectly determine that a string with digits and underscores qualifies as a number (or some of it does :smirk:) while isNaN will bark on the same string.