You can use .map()
with Object Destructuring:
let data = [
{a:1,b:5,c:9}, {a:2,b:6,c:10},
{a:3,b:7,c:11}, {a:4,b:8,c:12}
];
let result = data.map(({ a, b }) => ({a, b}));
console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }
More Related Contents:
- Why can I add named properties to an array as if it were an object?
- Filter array of objects with another array of objects
- Create an empty object in JavaScript with {} or new Object()?
- What’s the difference between “{}” and “[]” while declaring a JavaScript array?
- Filtering array of objects by searching nested object properties
- Filter nested array in object array by array of values
- How to get all keys with values from nested objects
- How do I check if an array includes a value in JavaScript?
- Most efficient method to groupby on an array of objects
- Convert Array to Object
- How to iterate over a JavaScript object?
- What is the difference between ( for… in ) and ( for… of ) statements?
- Filter array of objects based on another array in javascript
- Firestore Update single item in an array field
- How to filter an array from all elements of another array
- How can I access and process nested objects, arrays or JSON?
- How to transpose a javascript object into a key/value array
- Check if object value exists within a Javascript array of objects and if not add a new object to array
- How to copy JavaScript object to new variable NOT by reference? [duplicate]
- Create object from array
- Comparing two arrays of objects, and exclude the elements who match values into new array in JS
- Count duplicates within an Array of Objects
- Using JavaScript what’s the quickest way to recursively remove properties and values from an object?
- Array.includes() to find object in array
- How to merge each object within arrays by index?
- How to use Array.prototype.filter with async?
- Lodash create collection from duplicate object keys
- Converting Array of Objects into Array of Arrays
- Difference between ( for… in ) and ( for… of ) statements?
- Find object having maximum value for the `id` property in an array of objects