1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibJS: Trim whitespace from string before coercing to number

This commit is contained in:
Linus Groh 2020-05-13 00:28:42 +01:00 committed by Andreas Kling
parent f39c7c2978
commit de42ddfd93
2 changed files with 4 additions and 2 deletions

View file

@ -35,6 +35,9 @@ try {
assert(-"Infinity" === -Infinity);
assert(-"+Infinity" === -Infinity);
assert(-"-Infinity" === Infinity);
assert(+" \r \t \n " === 0);
assert(+" \n \t Infinity \r " === Infinity);
assert(+"\r \n1.23 \t\t\t \n" === 1.23);
assert(isNaN(+undefined));
assert(isNaN(-undefined));