10.To learn it, you gotta 'do'it


#1


I've been figuring out how this code is organised and have been struggling. Please help. This might be a result of me not focusing.


var zombies=false;

var getToDaChoppa = function(x) {
    do {
        console.log("We should get to the chopper in "+ zombies
        +"time")
    }
    while(zombies) ;{
        console.log ("Get to Da Choppa!")
  
  
}

getToDaChoppa();


#2

Take the "x" out of var getToDaChoppa = function(x)

should just be function()

also on the last closing squiggly bracket put a semicolon.

Also you forgot semi colo- you're forgetting semi-colon's everwhere. Both your console.log() needs a ; after the closing parantheses.


#3

In addition to what @demtemblem said you should always look if your brackets and parenthesis match, here you have 3 opening { but only two closing }.

Also are you aware that a do/while loop is only this part:

  do {
        console.log("We should get to the chopper in "+ zombies
        +"time")
    }
    while(zombies) ;

because you start a { directly after it and even if this had a matching } it would have no connection at all to the while loop before.


#4

Solved :slight_smile: . Thanks alot, I appreciate it.


#5

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