Is Subtracting Zero some sort of JavaScript performance trick?

前端 未结 7 1181
一向
一向 2020-12-06 00:32

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

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

And I wa

相关标签:
7条回答
  • 2020-12-06 01:20

    If it's not an old relic that got lost, then it just tries to change the type to Number.

    0 讨论(0)
提交回复
热议问题