Why does this return an error? Functions, randomization, innerHTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does this return an error? Functions, randomization, innerHTML

This is my code: function randomInt(param1){ return Math.floor(Math.random()*param1); }; var body = document.body; body.innerHTML += randomInt(10); Why does this produce an error?

21st Jun 2019, 3:21 AM
YoBoi
2 Answers
+ 2
No errors, the code is working. https://code.sololearn.com/WRD5TLkvbzzx/?ref=app
21st Jun 2019, 4:20 AM
Calviղ
Calviղ - avatar
0
How come when I cut that code out and place it in the JS section I receive an error?
21st Jun 2019, 1:18 PM
YoBoi