This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in [0...someCount] | |
doSomething() | |
# For in Obj at one line | |
for key , value of Obj then if key != Obj.length then console.log 'key', key , 'value',value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function preloadImages(srcs, imgs, callback) { | |
var img; | |
var remaining = srcs.length; | |
for (var i = 0; i < srcs.length; i++) { | |
img = new Image(); | |
img.onload = function() { | |
--remaining; | |
if (remaining <= 0) { | |
callback(); | |
} |
NewerOlder