Is there any javascript function to search an element in the array of objects.
We have sort function in javascript to sort an array of objects.
[
{name:'a', value:'1'},
{name:'b', value:'2'},
{name:'c', value:'3'},
{name:'d', value:'4'},
{name:'e', value:'5'}
]
You could use the ES5
Array.prototype.filtermethod (MDN article). For example, to reduce the array to only those objects with anameproperty of “a”:This is not supported by older browsers, but there are plenty of polyfills available for it.