10/11 Page freezes


#1

Hi there

Everytime I type my code in the script.js part, the page seems to freeze and so I can't do anything else after that.
It's the only page I've experienced so far on codeacademy, can anyone help?

Thanks in advance for your help!


#2

Sound like an infinite loop could you post the code?


#3

here's what I got to work, I hope it can help... by changing getToDaChoppa to false I'm stopping the code

var getToDaChoppa = function(){
// Write your do/while loop here!
do { console.log("I'm printing this part of the loop now!"); } while (getToDaChoppa = false)
};

getToDaChoppa();


#4

Sry but this is not a good idea:

while (getToDaChoppa = false)

sure it works because in the end it just means false but it's a really bad habit. At first never use the name of your function as a variable inside of your function. The idea of functions is that the code can be used multiple times, this can't because this:

getToDaChoppa = false

overwrites your function with false.As an assignment it has the value that is assigned so false which works but really rather just use false instead or use a variable with a different name and a value of false but don't make this a habit.


#6

many thanks for the info haxor789, I appreciate the help