[Webkit-unassigned] [Bug 32342] New: Javascript string comparison

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 9 12:49:06 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=32342

           Summary: Javascript string comparison
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.6
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: matt at outten.net


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."); }

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list