What is wrong here? When to While and when to for?


for(i = 0; i < 21; i++){

var Boom = function();

while(Boom===true) {
    console.log("While loop");
    Boom === false;


For functions the {} that indicate what belongs to the function are mandatory so instead of the semicolon wrap the stuff that should be inside of the function in {}. Also be careful with your variable names as Boom is the name of your function and functions are not true. Also Boom === false would compare your function to false but what you probably intended to do here is to assign value of false to Boom, didn't you? That would've been done by Boom = false;.


Thank you that worked!!!