I think there is a bug


#1

I think there is a bug on Introduction to Objects I - lesson 3...Ah the good!

Everytime I press 'Save & Submit Code' button my browser pop up print page window and it keep opening it no matter what I do. When I click on cancel it opens it again in a second. When I click print, it does the same. When I want to close window, it doesn't allow. When I want to quit browser, it doesn't allow that too. Only solution is to restart computer.

This happens both on my Macbook Pro with El Capitan and desktop PC with windows 7 and both on safari and mozilla firefox. I didn't try with other browsers.

Does anyone have same problem


#2

@rugbycode,

Could you provide the code you are using when this occurs...?


#3

Of course

for (var i = 0; i < 20; i++) {
    if (i % 3 == 0) {
            print('Fizz');
        } else if (i % 5 == 0) {
            print('Buzz');    
        } else if (i % 3 == 0 && i % 5 == 0) {
            print('FizzBuzz');
        } else {
            print('Whatever');    
        }
    }

#4

@rugbycode,

should be the =first= condition to be tested...!!!!


#5

Thanks @leonhard_wettengmx_n, you are right, but that's not why I posted this.

I posted this because there is a bug when submit button is pressed, no matter what code is written.


#6

@rugbycode,

for (var i = 0; 0 < 20; i++) {
    if  (i % 3 == 0 && i % 5 == 0) {
            console.log('FizzBuzz');
    } else if (i % 5 == 0) {
            console.log('Buzz');    
   } else if (i % 3 == 0 ) {
            console.log('Fizz');
   } else {
            console.log(i);    
  }
}

#7

@leonhard_wettengmx_n
It looks like your code would produce an infinite loop, as the second condition of your iteration reads 0 < 20, which is never not the case, thus the loop will never stop running.


#8

@ninja1972,

the for-loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for