Loops in JavaScript typically help solve problems which involve repeating specific code x amount of times. Say you need to log a message 5 times. You could do this:
console.log("a message");
console.log("a message");
console.log("a message");
console.log("a message");
console.log("a message");
But that's just time-consuming and kind of ridiculous. Plus, what if you needed to log over 300 messages? You should replace the code with a traditional "for" loop:
for(var i = 0; i < 5; i++){
console.log("a message");
}