Please look at my code:
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Click Now</button>
<p id="PPP"></p>
<script>
function myFunction() {
var x = 123456789987654321.987654321123456789;
document.getElementById("PPP").innerHTML =x;
}
</script>
</body>
</html>
Why when I press the button I see 123456789987654320
and not the whole number?
I want the paragraph text to be the whole number, that is 123456789987654321.987654321123456789
.
I know I can cast the number to a string and then go over all the chars in the array. Do you know a simpler way?