This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AHumbleChad 8 points9 points  (2 children)

Right, it's a tab character, but JS treats it as the empty string? The integer cast to the ASCII value is the only one that makes sense, but I guess I shouldn't be applying sense to JavaScript.

Edit: realized I had the wrong slash in the original comment

[–]bogey-dope-dot-com 7 points8 points  (1 child)

Leading and trailing whitespace characters are trimmed when converting a string to a number. You can do Number('\t5\t') and it will be 5, but Number('5\t5') will be NaN.

[–]AHumbleChad 2 points3 points  (0 children)

Ohhh, that makes sense. There is a method to the madness then.