i have a problem with the following situation:
I have an Array of Objects which all contains the same attribute, which is called src
Before adding a new Object (with an src
attribute too), I want to check if the value already exists in just one src
attribute in the Objects Array.
Therefore I wanted to use $.inArray()
with the new src
as first parameter and as array not the array of objects, but the array of the values of the attributes from the objects array.
As Example:
I have
var arrayOfObjects = [{
src : "source1",
otherAttribute : "value"
}, {
src : "source2",
otherAttribute : "value"
}];
My question is: Is there a build in function in JavaScript/jQuery which returns
["source1","source2"]
when called with functionX(arrayOfObjects)
?