How can I find if an array of objects includes an element?
Suppose code is
var searchEngines = [{
name: 'google',
link: 'https://google.com'
},
{
name: 'bing',
link: 'https://bing.com'
}];
//now I want to check if bing includes in array searchEngines or not (below code is wrong, please correct it)
console.log(searchEngines.name.includes('bing'));
//must return true. but it doesn't say true instead gives me an error and crashes the app.
so how can I check if searchEngines array includes bing or not?
Now if successfully checked that bing is included in searchEngines array, now how can I access bing?
like I wanna get the index number of bing array inside searchEngines array and then grab the link of it and console.log it, so I'll get https://bing.com