Skip to content

Latest commit

 

History

History
9 lines (9 loc) · 295 Bytes

Javascript.md

File metadata and controls

9 lines (9 loc) · 295 Bytes

Javascript

ES6

# Obtain a subset of an object, using Object Destructuring and Property Shorthand
# Source: https://stackoverflow.com/a/39333479
const object = { a: 5, b: 6, c: 7  };
const subset = (({ a, c }) => ({ a, c }))(object);
console.log(subset); // { a: 5, c: 7 }