Romeo F.

asked • 07/22/15

JavaScipt question

can someone take a look at this please?
if me hit once, dragon hits back.
i'ts not doing something right
function Hit() {
var damage1 = Me.damage();
var damage2 = Dragon.damage();
var i;
var temp1 = 0;
var temp2 = 0;
console.log(Dragon.hitPoints+" Dragon Hitpoints");
for (i = 0; i < Dragon.hitPoints; i++) {
temp1 = Dragon.hitPoints - damage1[i];
return console.log(temp1+" temp1");
if (temp1 === 0) {
return console.log("Dragon is dead");
} else if (temp2 === 0) {
return console.log("I just died :(");

1 Expert Answer


David T. answered • 09/13/15

New to Wyzant

Experienced Software Engineer

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.