ECMAScript5 provides a map
method for Array
s, 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);
More Related Contents:
- phone number validation in js [closed]
- When is .then(success, fail) considered an antipattern for promises?
- What is the JavaScript >>> operator and how do you use it?
- Multi-row insert with pg-promise
- Dealing with float precision in Javascript [duplicate]
- Is this an example of variable shadowing in JavaScript?
- Render basic HTML view?
- Memory leak risk in JavaScript closures
- How to do a Jquery Callback after form submit?
- Pretty printing XML with javascript
- How to improve performance of ngRepeat over a huge dataset (angular.js)?
- Can you force Vue.js to reload/re-render?
- Using querySelectorAll to retrieve direct children
- JavaScript double colon (bind operator)
- Get function name in JavaScript
- What do the different readystates in XMLHttpRequest mean, and how can I use them?
- How to auto-scroll to end of div when data is added? [duplicate]
- How can I get an object’s absolute position on the page in Javascript? [duplicate]
- bitwise AND in Javascript with a 64 bit integer
- Bootstrap datepicker disabling past dates without current date
- jQuery scrolltop firefox not working
- What reason is there to use null instead of undefined in JavaScript?
- Does Javascript slice method return a shallow copy?
- How to play wav audio byte array via javascript/html5?
- Most modern method of getting mouse position within a canvas in native JavaScript [duplicate]
- Disable elastic scrolling in Safari [duplicate]
- Is it good to call subscribe inside subscribe?
- getMinutes() 0-9 – How to display two digit numbers?
- Deobfuscating Javascript [closed]
- Is there a good use case for the constructor property in Javascript?