What is wrong with this code?

What is wrong with this code? When the earthquake level is 7, it doesn’t print anything.


1 Like

Hey there, great question, and cool code!

The issue is in your first if statement, where you’re using the less than operator < with the string 'too high to count'. This will always return false, because you’d be comparing a number like 7 to a string of text.

This is an instance where JavaScript should give us an error and let us know there’s a problem, but doesn’t, because JavaScript can be weird sometimes!

Try changing it to if (earthquakeLevel > 5 && earthquakeLevel < 11) or <= 10. That should do the trick!

Good luck! Let me know if you have any questions.