+ 3
Could someone explain me how this code works line to line? Thanks.
var arr=[2,5,2,4]; var x=1; for(var i=0;i<arr.length;i++){ if(arr[i]%2===0) x*arr[i]; } alert(x);
3 Answers
+ 3
How to get to the output x=16 in this code?
var arr=[2,5,2,4]; var x=1; for(var i=0;i<arr.length;i++){ if(arr[i]%2===0) x*arr[i]; } alert(x);