Is Minus Zero some sort of JavaScript performance trick?

Posted by James Wiseman on Stack Overflow See other posts from Stack Overflow or by James Wiseman
Published on 2010-04-19T08:04:13Z Indexed on 2010/04/19 8:13 UTC
Read the original article Hit count: 301

Filed under:
|

Looking in the jQuery core I found the folloiwng code convention:

nth: function(elem, i, match){
    return match[3] - 0 === i;
},

And I was really curious about the snippet match[3] - 0

Hunting around for '-0' on google isn't too productive, and a search for 'minus zero' brings back a reference to a Bob Dylan song.

So, can anyone tell me. Is this some sort of performance trick, or is there a reason for doing this rather than a parseInt or parseFloat?

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery