+ 1

HELP! Why isnā€™t my javascript code working?

Objective: 1. I want to set the variable ā€œnameā€ = the userā€™s input after asking for the name of the koala. Iā€™m not sure if I did it right. 2. After the function Name() runs, then I want to change the <h1> to the name of the koala. Can someone tell me why the header isnā€™t changing to the name of the koala? https://code.sololearn.com/We4BFeQJk50E/?ref=app

17th Feb 2020, 9:02 PM
tori the crafter šŸ’›
tori the crafter šŸ’› - avatar
5 Answers
17th Feb 2020, 10:08 PM
Cmurio
Cmurio - avatar
+ 5
Yes, is equal a document.getElementById("printName").innerHTML=name;
17th Feb 2020, 10:15 PM
Cmurio
Cmurio - avatar
+ 1
Here is an example based on your code https://code.sololearn.com/WLb7mGMV4WLO/?ref=app
17th Feb 2020, 10:03 PM
Gabriel Ilie
Gabriel Ilie - avatar
+ 1
The condition firstFunction === true is executed before your function Name()
17th Feb 2020, 10:07 PM
Gabriel Ilie
Gabriel Ilie - avatar
0
Jesus Eduardo Canul Koyoc thank you so much! Is ā€˜nā€™ a variable?
17th Feb 2020, 10:13 PM
tori the crafter šŸ’›
tori the crafter šŸ’› - avatar