0

This is my post id:

var postId = 47213486358396931;
var postComments = "Comment";

adding in object like this

var param = {
    "PostId" : postId,
    "postComment":postComments
} 

If I print the param I get like this. The last digit of number changed to 0. Why am getting like this.

{"PostId" : 47213486358396930, "postComment": "Comment"}
Jaqen H'ghar
  • 16,186
  • 8
  • 49
  • 52
KSK
  • 636
  • 1
  • 9
  • 29
  • 6
    `47213486358396931 > Number.MAX_SAFE_INTEGER`. This behavior is by design. – Frédéric Hamidi Jul 25 '16 at 14:17
  • Holy crap, did you made 47213486358396931 posts? If you are want to pass it, pass it as a string `'47213486358396931'` – vaso123 Jul 25 '16 at 14:19
  • Further information (and tips to work around this!) can be found here: http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html – N.J.Dawson Jul 25 '16 at 14:19

0 Answers0