I have an object with some keys, and I want to only keep some of the keys with their value?
I tried with filter:
filter
Native ES2019 one-liner
const data = { aaa: 111, abb: 222, bbb: 333 }; const filteredByKey = Object.fromEntries(Object.entries(data).filter(([key, value]) => key.startsWith("a"))) console.log(filteredByKey);