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

Tell us what’s happening:

Hello,
this step is asking to log the value of hit to the console using console.log().
I’ve tried many times, but I can’t seem to place the console.log() to where it’s suppose to go on the line. An example would be very helpful.
Thank you for your help.

Your code so far

function getMonsterAttackValue(level) {
  const hit = (level * 5) - (Math.floor(Math.random() * xp));```

### Your browser information:

User Agent is: <code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36</code>

### Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 144
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-144

Hi @Angel_gal

This code will display a string in the console.

console.log("hello");

Place the code on the next line.

If you use the above code, click
image

to see the result.

Happy coding

Hello,

I’m still having some difficulties.

function getMonsterAttackValue(level) {
const hit = (level * 5) - (Math.floor(Math.random() * xp))
console.log((level * 5) - (Math.floor(Math.random() * xp)));

}

It still isn’t go through for me. I don’t understand what I’m doing wrong. :face_exhaling:

Never mind I figured it out. I tend to over-complicate code sometimes. :sweat_smile:

1 Like