Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9204813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:48:01+00:00 2026-06-17T23:48:01+00:00

Possible Duplicate: javascript – Array.map and parseInt I saw this example of strange JavaScript

  • 0

Possible Duplicate:
javascript – Array.map and parseInt

I saw this example of strange JavaScript behavior on twitter

['10','10','10','10','10'].map(parseInt)

evaluates to

[10, NaN, 2, 3, 4]

could somebody explain this behavior? I verified it in chrome and firebug

['10','10','10','10','10'].map(function(x){return parseInt(x);})

correctly returns an array of 10s as integers. Is this an improper use of map(), a bug with parseInt, or something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:48:03+00:00Added an answer on June 17, 2026 at 11:48 pm

    parseInt receives two arguments: string and radix:

    var intValue = parseInt(string[, radix]);

    while map handler’s second argument is index:

    … callback is invoked with three arguments: the value of the element,
    the index of the element, and the Array object being traversed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: javascript - Array.map and parseInt I stumbled across the following code snippet:
Possible Duplicate: Javascript - array.contains(obj) What's wrong with this: var zipCodes =(['90001','90002','90003']); Test if
Possible Duplicate: Javascript swap array elements For example i have an array var arr
Possible Duplicate: JavaScript Array Delete Elements So, in javascript, I have this set up:
Possible Duplicate: JavaScript: why does parseInt(1/0, 19) return 18? Why does parseInt(1/0, 19) evaluate
Possible Duplicate: JavaScript losing “this” object reference with private/public properties Why does the second
Possible Duplicate: javascript - check if string begins with something? I've read in this
Possible Duplicate: Javascript array sort and unique I was surprised to see that there
Possible Duplicate: Javascript closure inside loops - simple practical example I'm having a problem
Possible Duplicate: Javascript closure inside loops - simple practical example Recently I have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.