Skip to content

Instantly share code, notes, and snippets.

@mcgingras
Created December 10, 2019 05:41
Show Gist options
  • Save mcgingras/7c41c4e02f43ea911890f874564664d1 to your computer and use it in GitHub Desktop.
Save mcgingras/7c41c4e02f43ea911890f874564664d1 to your computer and use it in GitHub Desktop.
confusing
class Test {
constructor(arr){
console.log(arr);
this.arr = arr;
}
addHello(i){
this.arr[i] = 'hello';
}
}
const program = [1,2,3,4,5];
const loopCommands = (program) => {
let arrList = [];
for(let i = 0; i<5; i++){
arrList[i] = new Test(program);
arrList[i].addHello(i);
}
return arrList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment