8. When to 'while' and when to 'for' (while loop)


I can't seem to figure out what i'm doing wrong on the while side. Here's my loop:

var whileLoop = function() {
    var myCondition = 1;
    while(myCondition <= 5) {

This seems to output nothing. What have i done wrong? Thanks in advance!


You need to call the function whileLoop by whileLoop() the loop itself seems to be ok.


Well whaddya know. Worked a charm. Not sure how i missed that. Thanks!