Dragon Slayer! (Declare your variables)



I'm stuck! help please, it says:

Oops, try again. Did you remember to set totalDamage to 0?

What's wrong with my code here?:

var slaying= true;
var youHit= math.floor(math.random() * 2);
var damageThisRound= math.floor(math.random()*5 + 1);
var totalDamage=0;

Thank you in advance.


Name of the object used to perform mathematical operations is Math, not math.

You have to change all occurrences of math to Math.


Thanks a lot, it worked! didn't pay attention to that one. wow it's too sensitive :slight_smile:
appreciate your response sir


Also, do you know how I can change my number on my profile to make it a name instead?

People can mention you as @003556824


You're very welcome :slight_smile:

I am not sure, but I would try to change username here -> https://www.codecademy.com/account


It worked. Thanks for helping me twice!


Great! Glad I could help :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.