Conversation
Notices
-
@paulo @roboneko @Abby @node @driftwood the problem is that parseInt says an empty string is not a number (agreed) but isNaN does not.
-
@paulo @Abby @driftwood @node @roboneko here's another one.
Let's say you have a string '100021_00'. parseInt will not stop and say 'woah not a number' like it did with the empty string. Instead it will return the 100021 portion. This means that the previous test of using `isNaN(parseInt('100021_00'))` will return false. if you check isNaN on the string itself it will say it's not a number.
-
@roboneko @Abby @paulo @node @driftwood yeah parsing it as int and returning the integer bits would make more sense than truncating it I agree :shrug:
-
@node @thatguyoverthere @Abby @paulo @node @driftwood that's terrible. error, understandable. xxx_yy return xxxyy would be perfectly reasonable (common string literal notation). xxx_yy -> xxx is simply wrong
-
@roboneko @Abby @driftwood @node @paulo
```
parseInt('s100') // NaN
parseInt('100s') // 100
```
-
@roboneko @Abby @paulo @node @driftwood you can see from above it's not just _ but any string that starts with digits seems to parse into *something*
-
@node @thatguyoverthere @Abby @paulo @node @driftwood _ is a special case because string literal notation. same for ' but you probably don't want 123xyz456abc000 to successfully parse that seems obviously wrong
also I don't think 1___2 should parse either, just that 1_2 is reasonable enough to interpret as 12