I have a javascript function :
function isInSupplier(idsupplier) {
    suppliers.forEach(function(object) {
        if (object._id == idsupplier) {
            console.log("TRUE");
            return true;
        };
    });
    return false;
I have a list of products, each have a suppliers. I want to make a list of unique suppliers, therefore is the supplier is already in my suppliers list i will not add a new one.
Here is my function to do so :
    console.log(isInSupplier(('<s:property value="supplier.id" />')));
    if (!isInSupplier(('<s:property value="supplier.id" />'))) {
        suppliers.push(new supplier(
                ('<s:property value="supplier.id" />'),
                ('<s:property value="supplier.supplier_name" />'),
                ('<s:property value="supplier.type" />'),
                ('<s:property value="supplier.phone" />')
        ));
    }
And there is something i don't understand : even tho the console logs "TRUE" properly, the function doesn't return true. In my second block of code i have another console log; that always logs false.
What is it i'm missing ?
 
     
     
     
    