ECMAScript5 provides a map method for Arrays, applying a function to all elements of an array. Here is an example:

var a = ['1','2','3']
var result = a.map(function (x) { 
  return parseInt(x, 10); 
});

console.log(result);

See Array.prototype.map()

Answer from dheerosaur on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › parseInt
parseInt() - JavaScript | MDN
The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems).
🌐
DEV Community
dev.to › jules_k › array-map-parseint-in-javascript-3ig
Array.map & parseInt in JavaScript - DEV Community
August 18, 2020 - For '1' in base 0, parseInt evaluates 0 as falsey and the effect is the same as not passing a radix argument and it defaults to 10 so it is like writing it parseInt('1', 10) For '2' in base 1, it returns NaN, because radix must be an integer between 2 and 36. For '10' in base 2, it evaluates to 2. If you want to convert array string values to integer values you could do this:
🌐
W3Schools
w3schools.com › jsref › jsref_parseint.asp
JavaScript parseInt() Method
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST ... Array[ ] Array( ) at() concat() constructor copyWithin() entries() every() fill() filter() find() findIndex() findLast() findLastIndex() flat() flatMap() forEach() from() includes() indexOf() isArray() join() keys() lastIndexOf() length map() of() pop() prototype push() reduce() reduceRight() rest (...) reverse() shift() slice() some() sort() splice() spread (...) toReversed() toSorted() toSpliced() toString() unshift() values() valueOf() with() JS Boolean
🌐
Raddevon
raddevon.com › articles › cant-use-parseint-map-javascript
Why can't I use parseInt with map in Javascript? » Rad Devon
With our new understanding, we can dissect the problem. parseInt takes the radix as the second argument. map is passing three arguments, the second of which is the index of the current item.
🌐
Will Vincent
wsvincent.com › javascript-parseint-map
JavaScript: parseInt and map | Will Vincent
January 3, 2018 - parseInt(100); // 100 parseInt(100, 10); // 100 parseInt(100, 2); // 4 -> converts 100 in base 2 to base 10 · map() to iterate over an array.
🌐
Medium
medium.com › dailyjs › parseint-mystery-7c4368ef7b21
Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in Javascript | by Eric Tong | DailyJS | Medium
July 11, 2019 - Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in Javascript Javascript is weird. Don’t believe me? Try converting an array of strings into integers using map and parseInt. Fire up your …
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › parseint
The parseInt Function in JavaScript - Mastering JS
parseInt('0xFF'); // 255, radix set to 16 implicitly parseInt('0xFF', 10); // 0 · Did you find this tutorial useful? Say thanks by starring our repo on GitHub! The `setTimeout()` Function in JavaScript · JavaScript Array flatMap() How to Get Distinct Values in a JavaScript Array ·
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-array-of-strings-to-array-of-numbers-in-javascript
How to convert array of strings to array of numbers in JavaScript ?
July 23, 2025 - In this method, we traverse an array of strings and add it to a new array of numbers by typecasting it to an integer using the parseInt() function.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › map
Array.prototype.map() - JavaScript | MDN
parseInt is often used with one argument, but takes two. The first is an expression and the second is the radix to the callback function, Array.prototype.map passes 3 arguments: the element, the index, and the array. The third argument is ignored by parseInt — but not the second one!
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Number › parseInt
Number.parseInt() - JavaScript | MDN
function roughScale(x, base) { const parsed = Number.parseInt(x, base); if (Number.isNaN(parsed)) { return 0; } return parsed * 100; } console.log(roughScale(" 0xF", 16)); // Expected output: 1500 console.log(roughScale("321", 2)); // Expected output: 0
🌐
TutorialsPoint
tutorialspoint.com › how-to-convert-array-of-strings-to-array-of-numbers-in-javascript
How to convert array of strings to array of numbers in JavaScript?
The parseInt() method is a built-in function in JavaScript that takes a string as an argument and returns a number. This method can be used to convert an array of strings to an array of numbers.
🌐
Medium
medium.com › @vdsnini › why-1-9-3-map-parseint-returns-1-nan-nan-in-javascript-5c21cf24d4dc
Why [‘1’, ‘9’, ‘3’].map(parseInt) returns [1, NaN, Nan] in Javascript | by Beenish Khan | Medium
May 31, 2024 - element: The current element being ... parseInt is a built-in JavaScript function that parses a string argument and returns an integer of the specified radix (base):...
🌐
Reddit
reddit.com › r/programming › why ['1', '7', '11'].map(parseint) returns [1, nan, 3] in javascript
r/programming on Reddit: Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in Javascript
June 24, 2019 - The index is passed in as the second value for map, and parseInt accepts 2 params, the second one determines the number base (like binary vs base 10) ... This shit is the reason I always use arrow functions as the parameter instead of passing the function directly. Trying to chase down this error would drive me insane. ... TL;DR. .map() works differently than in any other language, because why the fuck not, it's JS ... where yourArray is the input array passed in.
🌐
Programiz
programiz.com › javascript › library › built-in › parseInt
JavaScript parseInt()
console.log(parseInt("875.99", 10)); // 875 console.log(parseInt("F", 16)); // 15
🌐
DEV Community
dev.to › vcpablo › why-1-5-11mapparseint-in-js-returns-1-nan-3-4jdp
Why ['1', '5', '11'].map(parseInt) in JS returns [1, NaN, 3]? - DEV Community
December 19, 2024 - In JavaScript, the map function applies a given function to each element of an array and returns a new array with the results. When you use map with parseInt like ['1', '5', '11'].map(parseInt), the result might not be what you expect due to the way parseInt and map interact.