Re:Always return on events is faster, but why?
by Tarang on Friday October 18, 2013 @10:18AM
(#6571470)
Interesting, I would have never thought the js interpreter would interpret both as being === even though the two functions are different.
[ Parent
| on HN ]
Re:Always return on events is faster, but why?
by Stratoscope on Friday October 18, 2013 @12:24PM
(#6572197)
The two functions are different, but their return values are identical. The === is comparing the return values.
Consider this example:
function onePlusOne() { return 1 + 1; }
function two() { return 2; }
alert( onePlusOne === two ); // false, not the same function
alert( onePlusOne() === two() ); // true, same value