RESOLVED DUPLICATE of bug 32256 32342
Javascript string comparison
https://bugs.webkit.org/show_bug.cgi?id=32342
Summary Javascript string comparison
Matt O
Reported 2009-12-09 12:49:06 PST
This broken with the nightly build from Monday, Dec 7. Javascript appears to be evaluating the following code properly in console until you get to the last line. The expression is always being evaluated as "true". mystring = "02122010"; digits = mystring.substr(2,2); console.log("Digits value:"); console.log(digits); console.log("Digits type:"); console.log(typeof digits); console.log("This expression evaluates correctly as false: (digits > 12)"); console.log(digits < 1); console.log("This expression evaluates correctly as false: (digits > 12)"); console.log(digits > 12); console.log("This expression evaluates correctly as false: (digits < 1) || (digits > 12)"); console.log((digits < 1) || (digits > 12)); console.log("But it fails in real use: if ((digits < 1) || (digits > 12)) { console.log(\"Sorry, I don't like strings - even though I should.\"); }") if ((digits < 1) || (digits > 12)) { console.log("Sorry, I don't like strings - even though I should."); }
Attachments
Mark Rowe (bdash)
Comment 1 2009-12-09 13:41:25 PST
Maciej Stachowiak
Comment 2 2009-12-09 23:01:07 PST
This is caused by the same underlying bug as bug 32256. Marking duplicate of the higher-numbered bug because the other bug better reflects the impact. *** This bug has been marked as a duplicate of bug 32256 ***
Note You need to log in before you can comment on or make changes to this bug.