[
    {id: 1, name: 'foo'},
    {id: 2, name: 'bar'},
    {id: 3, name: 'test'}
]
I want to get check if the data exist and use the other field. example i want to check if 'id: 1' exist in the string and the 'name:foo'
[
    {id: 1, name: 'foo'},
    {id: 2, name: 'bar'},
    {id: 3, name: 'test'}
]
I want to get check if the data exist and use the other field. example i want to check if 'id: 1' exist in the string and the 'name:foo'
 
    
     
    
    You can use Array.propotype.filter
var list=[
    {id: 1, name: 'foo'},
    {id: 2, name: 'bar'},
    {id: 3, name: 'test'}
]
const result = list.filter(data => data.id == 2);
console.log(result);