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

Tell us what’s happening:

i use text do concatenation operator but still not solve

Step 119

Now you can build the attack function. First, update the text message to say The [monster name] attacks., replacing [monster name] with the name of the monster. Remember you can use the concatenation operator for this.

### Your code so far

text.innerText = "The " + monsters.name + " attacks ";

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 (Windows NT 10.0; Win64; x64) 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 119

it’s not the concatenation that is the issue, it is

remember that monsters is an array, so you need to access the object inside the array. Look at the goFight function for examples if you need a refresher

in this we use destruction right

sir @ilenia still i not got :(((

i try this but still i got error
monsterName.innerText = “The " + monsters[fighting].name + " attacks.”;

Tell us what’s happening:

i use this and this is correct but it still give me innerText

Step 119

Now you can build the attack function. First, update the text message to say The [monster name] attacks., replacing [monster name] with the name of the monster. Remember you can use the concatenation operator for this.

### Your code so far

monsterName.innerText =monsters[fighting].name;

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 (Windows NT 10.0; Win64; x64) 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 119

what error are you getting?

Now you can build the attack function. First, update the text message to say The [monster name] attacks., replacing [monster name] with the name of the monster. Remember you can use the concatenation operator for this.

code
`function attack() {
monsterName.innerText =monsters[fighting].name;

}`

i got this error
You should use dot notation to access the innerText property of text .

i got stuck from last night ;;(((

where is the rest of the string? now you have only the monster name

i sue this with string and still got error
monsterName.innerText = "The" + monsters[fighting].name + "attak";

You should use dot notation to access the innerText property of text .

you are not accessing text, you should add the string to that element, not to monsterName

i use with text and still got error
text.innerText = “The” + monsters[fighting].name + “attack”;

now you are missing spaces before and after the monster name

i give space sir
text.innerText = "The" + monsters[fighting].name + "attack";

You should assign the string The to innerText property of text .

you haven’t, that string doesn’t have a single space in it

sir i give the space and i use the string with "the " and “attack” word

sir srry i past code picture after you see i delete

now you have an extra space at the end

please post code instead of code picture