basic looping js code example
Example 1: forloop in js
for(i = 0; i < x; ++i){
//Loop, x can be replaced with any integer;
}
Example 2: loop javascript
for (var i = 0; i < cats.length; i++) {
if (i === cats.length - 1) {
info += 'and ' + cats[i] + '.';
} else {
info += cats[i] + ', ';
}
}