I have this little javascript code, it loops twelve times displaying the the number col, but at the same time I want to console “new row”, each time it hits the fourth element:
JS:
for(var col= 0; col < 12; col++){
if((col + 1) % 4 === 0)
console.log("New Row");
console.log(col)
}
This deosn’t seem to work, It consoles “New Row” on the third element, thanks
on rows – 4, 8 and 12 it outputs “New Row”