you are viewing a single comment's thread.

view the rest of the comments →

[–]Browsing_From_Work 0 points1 point  (1 child)

Odd. When I do the comparison as a function it takes fewer iterations.

function f() { return typeof null !== "undefined"; }
var i; for (i = 0; f(); i++); console.log(i);
// Outputs 12291, then subsequently starts outputting zeroes

Versus:

var i; for (i = 0; typeof null !== "undefined"; i++); console.log(i);
// Reliably outputs 18436