I\'m trying to square each number in an array and my original code didn\'t work. I looked up another way to do it, but I\'d like to know WHY the original code didn\'t work.<
Use embedded for , for pretty syntax :
for
var arr=[1,2,3,4] ; [for (i of arr) i*i ]; //OUT : > [1,4,9,16]