Created
September 7, 2017 12:49
-
-
Save LoLei/6c2f594c55db6d9dcaa3f93cf025ff77 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/kiwodam
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var loop = function(i, array) { | |
console.log(array[i]); | |
var increment = 10; | |
i++; | |
if (i < array.length) { | |
for (j = i; (j < i + increment) && (j < array.length); j++) { | |
loop(j, array); | |
} | |
} | |
} | |
console.log("start"); | |
var array = []; | |
for (var j = 0; j < 1000; j++) { | |
array.push(j); | |
} | |
var i = 0; | |
loop(i, array); | |
console.log("end"); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var loop = function(i, array) { | |
console.log(array[i]); | |
var increment = 10; | |
i++; | |
if (i < array.length) { | |
for (j = i; (j < i + increment) && (j < array.length); j++) { | |
loop(j, array); | |
} | |
} | |
} | |
console.log("start"); | |
var array = []; | |
for (var j = 0; j < 1000; j++) { | |
array.push(j); | |
} | |
var i = 0; | |
loop(i, array); | |
console.log("end");</script></body> | |
</html> |
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 loop = function(i, array) { | |
console.log(array[i]); | |
var increment = 10; | |
i++; | |
if (i < array.length) { | |
for (j = i; (j < i + increment) && (j < array.length); j++) { | |
loop(j, array); | |
} | |
} | |
} | |
console.log("start"); | |
var array = []; | |
for (var j = 0; j < 1000; j++) { | |
array.push(j); | |
} | |
var i = 0; | |
loop(i, array); | |
console.log("end"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment