Created
February 1, 2017 06:47
-
-
Save VoloshchenkoAl/6633b22464d2ccb07cb9dce4ac1278a2 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 findNodes = function (callback) { | |
var i = 100000, | |
nodes = [], | |
found; | |
// проверить, является ли объект callback функцией | |
if (typeof callback !== “function”) { | |
callback = false; | |
} | |
while (i) { | |
i -= 1; | |
// здесь находится сложная логика выбора узлов... | |
// теперь вызвать функцию callback: | |
if (callback) { | |
callback(found); | |
} | |
nodes.push(found); | |
} | |
return nodes; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment