Problem in coding the while loop statements


#1

hello guys. i am stuck in the while loop kindly help me... tell me plz what should i write in the following codes

Instructions
**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. **

//Remember to set your condition outside the loop!

var loop = function(){
while(){
//Your code goes here!
}
};

loop();


#2

while loop syntax:

while (condition) {
    code block to be executed
}

the while loop loops through a block of code as long as a specified condition is true.

So, initialize variable that will be a condition. Put it inside the paranthes. But condition should returns boolean value and tells for loop how many times code block should be executed.
In your case you need to print "I'm looping!" 3 times, so you need to use comparsion operator. Then log "I'm looping!". And don't forget to increment your variable, which is a condition for while loop.

Please, try my instruction and print your result.


#3

Ok. Kindly write the codes for me. Plz


#4

I told everything you need. Did you try to do it yourself? If I just write the code it doesn't make sence.


#5

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