I have a number of objects passed to a function as an argument such as:
$( document ).on( "custom.event", function( evt, obj ) {
console.log( obj );
});
The objects look like this (in console):
Object {name: "obj1", property: "", somethingElse: "some value"}
Object {name: "obj2", property: "1", somethingElse: "some value"} //I want this one!
Object {name: "obj3", property: "", somethingElse: "some value"}
Object {name: "obj4", property: "1", somethingElse: "some value"}
I would like to make use of the FIRST object where property is equal to "1" and have at my disposal the rest of the properties and their values (from said obj). How might I do this? I've tried $.each but couldn't work out how to only return the first object where property == "1".
Thanks