Hi I'm trying to take value from an object and find the sum. I currently have an object of three values and properties and would like to take the numbers and would like to add them and store them
public selectedItem = {name:" "}; // Separate Object that displays values. Dont want to display it just add the value
public shoppingListItems = [
{name: "Milk" ,number: 100},
{name: "Sugar", number: 22,},
{name: "bread", number: 12}
];
public Price = [];
this.Price.push(shoppingListItem.keys(this.selectedItem)); // Attempt to push my shopping list items onto the Price Array
console.log(this.Price); // Check is the values are actually stored.
I have attempted to create a separate array and store the values there by doing the following so that I may push my number values onto my array but it does not seem to do so. Would there be a way to just take the values out of my object and add them to my array so that I may store them and potentially add them later?