As an angular developer, I have limited knowledge of JavaScript shorthand methods.
I recently encountered a situation where I needed to loop through an array using a for loop in JavaScript.
Let's say I have an array of Objects like:
var arr = [{name:'abc', val:1}, {name:'xyz', val:2}, ....];
If given a string 'xyz', is there a more concise way in JavaScript or Angular to determine if my array of objects contains an object with the name 'xyz' without using a for loop?
I am hoping for a shorthand expression similar to the indexOf
function.
Any assistance would be greatly valued.