You should be able to simply map through all ids, keeping a reference to your index, and build your object based on that index.
var items = ids.map((id, index) => {
return {
id: id,
name: names[index],
country: countries[index]
}
});
More Related Contents:
- javascript extract certain properties from all objects in array
- Why are Objects not Iterable in JavaScript?
- Create object from array
- Filtering an array with a function that returns a promise
- How to generate range of numbers from 0 to n in ES2015 only?
- How to find duplicate values in a JavaScript array of objects, and output only unique values?
- Using Array objects as key for ES6 Map
- Convert ES6 Iterable to Array
- Get list of duplicate objects in an array of objects
- Extract certain properties from all objects in array
- spread operator vs array.concat()
- Unexpected comma using map()
- Replace element at specific position in an array without mutating it
- Find all values by specific key in a deep nested object
- Array.from() vs spread syntax
- How to delete property from spread operator?
- Compare two Arrays with Objects and create new array with unmatched objects
- JavaScript “new Array(n)” and “Array.prototype.map” weirdness
- Convert array to JSON
- How to find if an array contains a specific string in JavaScript/jQuery?
- How to change value of object which is inside an array using JavaScript or jQuery?
- Selecting last element in JavaScript array [duplicate]
- JavaScript flattening an array of arrays of objects
- Best way to convert string to array of object in javascript?
- Override a setter, and the getter must also be overridden
- Filter array of objects whose any properties contains a value
- Nested ES6 classes?
- React.js ES6 avoid binding ‘this’ to every method
- Is array both associative and indexed?
- What does the Array method `reduce` do?