Answers for "omit key from object js"

0

omit key from object js

o = {a: 1, b: 2, c: 3, d: 4}
exclude = new Set(['a', 'b'])
Object.fromEntries(Object.entries(o).filter(e => !exclude.has(e[0])))
// Object { c: 3, d: 4 }
Posted by: Guest on June-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language