Can anyone please help me with this solving this code in Javasript Quiz Project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone please help me with this solving this code in Javasript Quiz Project

https://code.sololearn.com/WA17a119A14A this is my code error occurs in last part in javscript

17th Jul 2021, 11:42 AM
अभि
अभि - avatar
3 Answers
+ 2
You forgot the backticks, `<h3> you scored ${score}/${quizDB.length} ✌</h3> <button class="btn" onclick="location.reload()">play again</button>`
17th Jul 2021, 11:57 AM
Abhay
Abhay - avatar
+ 1
You cannot put HTML tags like that in Javascript. For line 102, you need to put the html tag in quotes to make it a string. When you do that, another error on line 103 appears, because again, you can't put HTML tags in JS, you need to get the element you want to insert the tag into, using document.getElementById or other functions, and then use the createElement and appendChild functions.
17th Jul 2021, 11:46 AM
inxanedev!
inxanedev! - avatar
+ 1
inxanedev! You can assign the html that way without using createElement . All you need is to assign that html string to innerHTML property instead of textContent .
17th Jul 2021, 11:59 AM
Abhay
Abhay - avatar