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

Tell us what’s happening:

It wont copy the code right over to this new topic so had to copy and paste it. I have looked for the answer on reddit, quora, W3 site. Cant figure this out. I have a feeling its something simple because I remember calling a function before.

In your fightSlime function, set fighting equal to 0 - the index of slime in the monsters array. Remember that you already declared fighting earlier in your code, so you do not need let or const here.

On the next line, call the goFight function.

### Your code so far

function fightSlime() {
fighting = 0;
console.log (‘goFight’);
}

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.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

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

You are missing

On the next line, call the goFight function.

How do you call a function?

2 Likes

I think they’re having an issue figuring out how to call the function. you need to use the function name from where you are.
function1 eatbreakfast() {
blah, blah blah.
eatbreakfast = function2()
}
so you’re telling your function that you’re inside that it is now function 2 i believe.
Hope this helps. These things are much harder to research on the internet than html and css were (at least for me).

3 Likes

SOLUTION REMOVED

This is the correct way

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

2 Likes