Reputation: 25
im trying to create a completely random number but the code that i have created is not working
<div id="demo">
</div>
<script>
function myFunction()
{document.getElementById("demo").innerHTML=Math.floor((Math.random()*100000)++1)};
</script>
this is the code I have at the moment and the error message is 'Uncaught SyntaxError: Unexpected number'. it is clear I have done something wrong but I cant figure out what any help is welcome.
Upvotes: 0
Views: 54
Reputation: 15387
Try this, You are using ++
use only +
{
document.getElementById("demo").innerHTML=
Math.floor((Math.random()*100000)+1)
}
Upvotes: 1