getProductById: function(idProduct) { | getProductById: function(idProduct) { | ||||
var app = this; | var app = this; | ||||
for(var i = 0; i <= Object.keys(this.productsArray).length ; i++) { | |||||
for(var i = 0; i <= Object.keys(this.productsArray).length + 1 ; i++) { | |||||
if(app.productsArray[i] && app.productsArray[i].id == idProduct) { | if(app.productsArray[i] && app.productsArray[i].id == idProduct) { | ||||
return app.productsArray[i]; | return app.productsArray[i]; | ||||
} | } |