A lot of array functions take the form of ... var length = foo.length; for (var i = 0; i < length; i++) { if (!(i in foo) continue ... }