I have to display the stock price of each object inside an array whose number is below 100, but as the reference to the title, I cannot display the number of each stock price even though I used if statement. The error message says that:
stockPrice.js:85 Uncaught TypeError: Cannot read property '0' of undefined at lowToHigh (stockPrice.js:85) at HTMLButtonElement. (stockPrice.js:63)".
JS:
//Display all prices of the objects
for (var i = 0; i < stocks.length; i++){
if(stocks.price[i] < 100){
alert(stocks[i].company);
alert(stocks[i].price);
}
}
}
Aucun commentaire:
Enregistrer un commentaire