Tell us what’s happening:
function attack() {
text.innerText = “The” += monsters[fighting].name += “attacks.”;
}
This is my code. Idk why it doesn’t work.
Actually che hint above the code says “You should use dot notation to access the innerText property of text.”
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 120