Please change it to: Array.prototype.some()
The
some()method tests whether some element in the array passes the test implemented by the provided function.
function isInSupplier(idsupplier) { return suppliers.some(function(object) { if (object._id == idsupplier) { console.log("TRUE"); return true; }; }); } or without console output
function isInSupplier(idsupplier) { return suppliers.some(function(object) { return object._id == idsupplier; }); }