Please tell what isFinite('\r\n')
is equal to? The right answer is true
. Another wtfjs.com case?
The answer why is in ECMA-262 spec, §9.3.1, “ToNumber Applied to the String Type”:
The MV of StringNumericLiteral ::: StrWhiteSpace is 0.
The MV of StringNumericLiteral ::: StrWhiteSpaceopt StrNumericLiteral StrWhiteSpaceopt is the MV of StrNumericLiteral, no matter whether white space is present or not.