DEV Community

Max Angelo Dapitilla Perin
Max Angelo Dapitilla Perin

Posted on

Answer: How to get a subset of a javascript object's properties

I am adding this answer because none of the answers used Comma operator.

It's very easy with destructuring assignment and the , operator:

const object = { a: 5, b: 6, c: 7  };
const picked = ({a,c} = object, {a,c})

console.log(picked);

Top comments (0)