whats the total number of =s in:
q: issue searching list of objects (javascript) in lightning component essentially what i want to do is search my list of objects which are pushed using my handle products function. once the list has been populated i need to search if the list.cardtype contains card present then set a variable in my component to true.
i am being shown this error, but i have done some checks and its lead me to believe my handlenext function is the problem.
any ideas?
error : 

uncaught action failed: c:addproductscomponent$controller$handlenext
  [cannot read property 0 of undefined]

<aura:attribute name=productlist  type=list/>

controller
handleproduct: function(cmp, evt, helper){
var productid = cmp.find(producttype).get(v.value); 
var productname = cmp.find(producttype).get(v.value);
var midname = cmp.get(v.selectedrecord.name);
var midid = cmp.get(v.selectedrecord.id);
var cardtype = cmp.get(v.cardtype);
var pl = cmp.get(v.productlist);
cmp.set(v.options, productname);
/* creating the new product to add to the list. */
var product = {
    mid: midname,
    midid: midid,
    cardtype: cardtype,
    productid: productid,
    name: productname}; 
/* pushed the new product to the list to update the main list  */
pl.push(product);


/* updating the product list with new product. */
cmp.set(v.productlist, pl); 
},

 handlenext: function(cmp, evt){
     list = cmp.get(v.productlist);
     for (var i = 0; i < list.length; i++) {
        if (list[i].cardtype == card present) {
        console.log(true)
        cmp.set(v.showcp, true);
        }
}

    cmp.set(v.showhome, false);
},


a: list[i].cardtype is causing the problem, when i = 0, its trying to dereference list[0], but list is undefined. start by logging the value of v.productlist before that loop, and working backwards from there, to see whats going on.

user
The given text has 14 "="s.
assistant