I am a js beginner. I want to show some random float value between 1 to 50, just the demo value of sensor data. That's the code I have tried:
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
function myFunction() {
while(1)
{
document.getElementById("demo").innerHTML = Math.random()*50 + 1 ;
}
}
</script>
</body>
</html>
But it didn't work. Can anyone help? I want to show the number when the page loaded and constantly changing the value like dynamic data.