Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To store a price row in an array, you can create an empty array and then add each price value to the array using the push() method or by assigning a value to a specific index of the array. Here is an example code snippet:

let prices = []; // create an empty array

// add prices to the array using push()
prices.push(10.99);
prices.push(5.99);
prices.push(15.99);
prices.push(8.99);

// or add prices to specific indexes
prices[0] = 10.99;
prices[1] = 5.99;
prices[2] = 15.99;
prices[3] = 8.99;

console.log(prices); // output: [10.99, 5.99, 15.99, 8.99]