www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] parseInt() problem

Hybrid View

  1. #1
    Join Date
    Nov 2006
    Posts
    18

    resolved [RESOLVED] parseInt() problem

    Check this:

    parseInt("10150878873354251");

    returns 10150878873354252 using chrome 22.

    Why is it incrementing by +1?

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    That's a pretty big number... it's probably greater than Chrome can handle properly. If you test several similar numbers (10150878873354253, 10150878873354254, 10150878873354255, 10150878873354256 etc.) you can see that every other number fail to parse correctly.

    So, too big number! :)

  3. #3
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    Javascript integers are in the range -2^53 and +2^53 (−9007199254740992 to 9007199254740992)

    The value you have there is way out of range.

  4. #4
    Join Date
    Nov 2006
    Posts
    18
    You learn something new everyday! The number is a fb id for a photo. My mistake is using the id as a number instead of a string which probably makes more sense.

    Thanks for the info!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles