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

Hey everyone kindly walk me through this. my code is below;

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

The instruction is below;

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 browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15

Challenge Information:

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

Hi @Answer_Alyosha

On the first line of your code you correctly assigned the variable.
On the second line you need to call the function mentioned in the instructions. You coded for a console.log.

Happy coding

Hey kindly find my code for console.log;

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

Hi @Answer_Alyosha

Change the console.log line into the function mentioned in the instructions.

Hey I tried this but…

function fightSlime() {
fighting = 0;
goFight('goFight');
}

Hi @Answer_Alyosha

Just type the function mentioned in the instructions.
Don’t use the syntax in the fightDragon function as a guide.

whew

function fightSlime() {
fighting = 0;
goFight;

}
1 Like

I’m glad you found the solution.

Please move the code block from your reply as the forum discourages posting solutions.

it didn’t work bro. I only showed you that It didn’t work

Oops.

A function requires two rounded brackets.

the same thing bro, didn’t work.

function fightSlime() {
fighting = 0;
(goFight);
}

Use the fightSlime function as an example of where the round brackets are placed.

It worked. Appreciate.

1 Like