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

Tell us what’s happening:

What is wrong with my code even though I used the concatenation method

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function attack() {
text.innerText = "The" + monsters[fighting].name + "attacks.";
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 15_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/119.0.6045.169 Mobile/15E148 Safari/604.1

Challenge Information:

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

Hello!

Add a space after The and a space before attacks., inside of the quotation marks.

2 Likes

Hi @mohmedyahya833

Following the good advice of @zuhameer6 , here is an example of the text your code will produce:

TheDragonattacks.

Happy coding

2 Likes

Yup yup the test passed
Thanks much for help

1 Like