While loop: Tutorial 5/11
== Practice makes perfect ==
Problem: Write a
Solve:
var count= 0;
var loop = function(){
while(count < 3){
console.log("I'm looping!");
count++;
}
};
loop();
== Practice makes perfect ==
Problem: Write a
while
loop that logs "I'm looping!" to the console three times. You can do this however you like, but NOT with three console.log
calls. Check the Hint if you need help!Solve:
var count= 0;
var loop = function(){
while(count < 3){
console.log("I'm looping!");
count++;
}
};
loop();
No comments:
Post a Comment