Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js object filter by keys

const obj = { firstName: 'Jean-Luc', lastName: 'Picard', age: 59 };

// { firstName: 'Jean-Luc', lastName: 'Picard' }
Object.fromEntries(Object.entries(obj).filter(([key]) => key.includes('Name')));
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #js #object #filter #keys
ADD COMMENT
Topic
Name
4+3 =