Ask Your Question
4

How do I store the price row in an array?

asked 2022-04-19 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-12-23 20:00:00 +0000

lalupa gravatar image

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]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-04-19 11:00:00 +0000

Seen: 2 times

Last updated: Dec 23 '22