JavaScript Beginner - Problems with feedback

0

Why is not this code returning the right answer? I'm testing the Chrome console. In testing I change the value of var, but nothing happens.

Following the example of the class I'm doing, everything is correct. Am I forgetting some detail?

Follow the code:

var kills = 2;

		if (kills = 0){
			console.log('Seu noob!');
		
		}else if (kills > 1 && kills <= 3){
			console.log('Killer!');
		
		}else if (kills > 4 && kills <= 10) {
			console.log('Violent!');
		
		}else if (kills > 11){
			console.log('Unstoppable!');
		};
    
asked by anonymous 09.11.2015 / 20:59

1 answer

3

You are assigning a value ( kills = 0 ) within a if (condition).

If you want to compare values, use == :

if (kills == 0){}
    
09.11.2015 / 21:03