I am learning to code and I am trying out this javascript object method course. I am currently stuck on this method. I want to have the array with three different numbers(10,20,5) to be /2. I do not understand why it is returning NaN. Thank you for reading.
shirtPrice = 10
jeanPrice = 20
shoePrice = 5
shoppingList = [shirtPrice,jeanPrice,shoePrice];
const shoppingDiscountDay = {
discountedItems: {
calculateItemsDiscount() {
return shoppingList/2; //return NaN
},
}
}
console.log(shoppingDiscountDay.discountedItems.calculateItemsDiscount());