up
This commit is contained in:
parent
d7d25f4d8b
commit
20784e7f26
48 changed files with 302 additions and 397 deletions
|
@ -1,19 +1,13 @@
|
|||
function makeArmy() {
|
||||
|
||||
var shooters = [];
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
|
||||
var shooter = (function(x) {
|
||||
|
||||
return function() {
|
||||
alert(x);
|
||||
};
|
||||
|
||||
})(i);
|
||||
let shooters = [];
|
||||
|
||||
for(let i = 0; i < 10; i++) {
|
||||
let shooter = function() { // shooter function
|
||||
alert( i ); // should show its number
|
||||
};
|
||||
shooters.push(shooter);
|
||||
}
|
||||
|
||||
return shooters;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue