For my JavaScript Course i am stuck on a question.
The question is:
On the editor to your right you find a variable named charmanderLevel, to which a value between 1 and 100 will be assigned.
Using else if statements print to the console which evolution of Charmander corresponds to that experience level. Consider an else statement if the experience level ever go above 100 that should print 'Charizard is as good as it gets '.
Here's a chart with the evolution which corresponds to each level:
Charmander - 1 to 15
Charmeleon - 16 to 35
Charizard - 36 to 100
The code i've build
var charmanderLevel = Math.ceil(Math.random() * 100);
if (charmanderLevel =>1) {
console.log('Charmander');
} else if (charmanderLevel <=35) {
console.log('Charmeleon');
} else if (charmanderLevel <=100) {
console.log('Charizard');
} else {
console.log('Charizard is as good as it gets');
}
With this code i get the warning:
Code is incorrect There should be one if statement checking if the variable charmanderLevel is greater than 1 and lesser than 15
I've tried to change my code to a value of <=15 but that gives the same warning. Also tried to make something to use >=1 and <=15 but that doesn't solve it either.
What goes wrong here and how to solve this?