Dragon Slayer! (Declare your variables)


#1

https://www.codecademy.com/courses/javascript-beginner-en-mrTNH-6VIZ9/0/2?curriculum_id=506324b3a7dffd00020bf661#

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.


#2

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

You have to change all occurrences of math to Math.


#3

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


#4

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

Username:
003556824
People can mention you as @003556824


#5

You're very welcome :slight_smile:

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


#6

It worked. Thanks for helping me twice!


#7

Great! Glad I could help :slight_smile:


#8

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