Why does this return an error? Functions, randomization, innerHTML | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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