11. Review


#1

  1. "Review" On "Introduction to 'While' Loops in JS"

Must have an infinite loop somewhere or something...


for (var i= 1; i<11; i++) {
console.log(i);
}
var master = true;
while(master = false) {
    console.log("I'm mastering looping!");
    master = True;
}
var mastering = true;
do {
 console.log("I am mastering looping");
} while(mastering = true);


#2

we use = for assignment if we want to check whether two values are equal or not we should use == or ===

var mastering = true;
do {
 console.log("I am mastering looping");
} while(mastering = true);

you have an infinite loop here


#3

Thanks! Finally got it to work, but had to use the hint, redid it, and kind of copied it, lol. Also found out that my Do/while loop had an infinite loop in it. Thanks, though!

Working code: for (var i = 1; i<11; i++) {
console.log(i);
}
var mastering = true;
while(mastering) {
console.log("Hello!");
mastering = false;
}
var mastering = false;
do{
console.log("I am mastering looping");
} while(mastering == true);


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.