Learn Basic JavaScript by Building a Role Playing Game - Step 152

Tell us what’s happening:

My code didn´t pass validation.

Your code so far

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

function isMonsterHit(){
result = Math.random() > .2;
return result;
}

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.714 YaBrowser/23.11.1.714 Yowser/2.5 Safari/537.36

Challenge Information:

Learn Basic JavaScript by Building a Role Playing Game - Step 152

1 Like

I see a couple of issues

I don’t see a variable called result defined in your code

But you don’t need a result variable anyway to pass the test

The challenge wants you to return the result of this expression

You can ditch the variable all together and return that expression

hope that helps

2 Likes

Its just simple:

function isMonsterHit() {
  return Math.random() > .2;
}