Suppose i have am array of objects like this:
arr = [{time: 1, value: 2, word: 'fdfd'}, {time: 2, value: 3, word: 'dsadsadsa'}]
How to remove the time and word properties from each object? My output should be this:
arr = [{value: 2}, {value: 3}]
Suppose i have am array of objects like this:
arr = [{time: 1, value: 2, word: 'fdfd'}, {time: 2, value: 3, word: 'dsadsadsa'}]
How to remove the time and word properties from each object? My output should be this:
arr = [{value: 2}, {value: 3}]
You can try with Array.prototype.map() and Destructuring assignment
let arr = [{time: 1, value: 2, word: 'fdfd'}, {time: 2, value: 3, word: 'dsadsadsa'}];
arr = arr.map(({value}) => ({value}));
console.log(arr);