Tablica obiektów JavaScript zawiera
if (vendors.findIndex(item => item.Name == "Magenic") == -1) {
//not found item
} else {
//found item
}
Frail Fox
if (vendors.findIndex(item => item.Name == "Magenic") == -1) {
//not found item
} else {
//found item
}
vendors.filter(function(vendor){ return vendor.Name === "Magenic" })
const john = {
'name': 'John Doe',
'email': '[email protected]'
};
const jane = {
'name': 'Jane Doe',
'email': '[email protected]'
};
const list = [john, jane];
let result = list.includes(john);
console.log(result); // true
var obj = {a: 5};
var array = [obj, "string", 5]; // Must be same object
array.indexOf(obj) !== -1 // True
const magenicVendorExists = vendors.reduce((accumulator, vendor) => (accumulator||vendor.Name === "Magenic"), false);