Solo flight keeps crashing, please help!


get an infinite loop; browser tab crashes.


Replace this line with your code.

var count = 1;
var soloLoop = function(){
//Your code goes here!
while (count = 1){
console.log ("Looped once!");
count = 0;



When I run this code, the page becomes unresponsive. Don't understand why it's crashing if I am changing the count variable to false.


So I changed the 'while (count=1)' to 'while (count)' and that did the trick. ┬┐Como? My thinking is that 'count=1' would be a condition that couldn't change, b/c 'count=1' will always equal 1 even though I put the condition of changing the count to 0?


while(count=1) is always true, no matter what the value for count is. since you assign a value of 1 to count:


so then count is one, one is considered true, so you have a infinity loop. If you want to compare 1 with count you will have too use two equal signs:

while(count == 1)

now you compare count with 1.

the reason this:

while (count)

will work, is because 0 is considered false. While one is considered true


Makes sense, thanks!!