Created
January 26, 2017 16:57
-
-
Save kuznetsovandrey76/b10dc4ad256073ee01ecc00b5bed3ab6 to your computer and use it in GitHub Desktop.
This file contains 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
var arr = [ | |
[1,2], | |
[3,4], | |
[5,6] | |
]; | |
var temp = []; | |
for (var i = 0; i < arr.length; i++) { | |
temp.push(arr[i][0], arr[i][1]); | |
} | |
function foo(index, timeout) { | |
setTimeout(function(){ | |
console.log(temp[index]) | |
}, timeout); | |
} | |
for (var i = 0; i < temp.length; i++) { | |
// Вызываем функцию столько раз сколько элементов | |
foo(i, i * 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment