Is there an integer limit in javascript?

Possible duplicate:
What is Max Int? What is the highest value An integer can go without loss of precision?

Hi, I am assigning a php value (derived from POST) to a javascript variable. When I warn about this value, only 17 digits appear. Rest is replaced by 0. However, when I repeat the message, this is normal. Code below:

<?php
$data = $_POST['data'];  // value here is 12345678901234567890
?>
<script>
var d = <?php echo $data ?>
alert(d);  // value here is 12345678901234567000
</script>

Any idea why this is happening?

0
source share
4 answers

From Mozilla Docs

The MAX_VALUE property has a value of approximately 1.79E + 308. Values ​​greater than MAX_VALUE are represented as "Infinity."

See example

-1
source

, .

0

Here is the full Javascript link,

http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference

Inside the link, you can see that the integer value of the type is 15 digits.

0
source

All Articles