What is wrong with my code?


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/2/3?curriculum_id=506324b3a7dffd00020bf661#

<In what way does your code behave incorrectly? Include ALL error messages.>
My page crashed each time I click “save and submit code”.

```

var getToDaChoppa = function(){
var dachoppa = true
// Write your do/while loop here!
do {console.log(“Let’s go, let’s go!”)
} while (dachoppa) {
console.log(“Oh no it’s already gone!”)
dachoppa = false
}
};

getToDaChoppa();

<do not remove the three backticks above>

#2

you created an infinity loop. There are two types of loops you are using here, a do while:

do {
  /* do something */
} while (condition)

and a while loop:

while (condition){
   /* do something */
}

you seemed to have to combined them in a impossible way/fashion.


#3

Thank you for responding!
How did I combine them wrong? They don’t refer to each other, do they? I fail to see where I went wrong :sweat:


#4

No, they don’t but you have a do while loop:

do {console.log("Let's go, let's go!")
  } while (dachoppa)

here while is part of the do while loop, but you also transformed the while of the do while loop into a while loop:

do {console.log("Let's go, let's go!")
  } while (dachoppa) {
      console.log("Oh no it's already gone!")
      dachoppa = false
  }

while is now part of a do while loop and a while loop, that is impossible.


#5

Aha I see!
Thank you for correcting the error of my ways!
It is now running as it should :smile:
Thank you!


#6

You corrected it, well done :slight_smile: I only pointed where the error was