Reading through the source code of underscore.js
I stumbled upon the following line:
... if (obj.length === +obj.length) { ...
That's a bit confusing for me. What is actually being compared here? I believe it has something to do about detecting native arrays, but cannot figure out what's actually going on. What does the +
do? Why use ===
instead of ==
? And what are the performance benefits of this style?