Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Search array of objects for existing value

const arrayOfObject = [{ id: 1, name: 'john' }, {id: 2, name: 'max'}];

const checkUsername = obj => obj.name === 'max';

console.log(arrayOfObject.some(checkUsername))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Search #array #objects #existing
ADD COMMENT
Topic
Name
2+4 =