I have declared array object variable which is ordered_items and it seems to be fine. But now how can I retrieve every item inside the object variable using foreach loop in javascript. Thanks in advance.
var ordered_items = [];
for(var x = 0; x < prev_tbl_rows.length; x++){
var product = $(prev_tbl_rows[x]).find("td.one_prod_name").text();
var quantity = $(prev_tbl_rows[x]).find("td.one_qty").text();
var price = $(prev_tbl_rows[x]).find("td.oneprice").text();
var subtotal = $(prev_tbl_rows[x]).find("td.oneSubtotal").text();
ordered_items.push({
product: product,
quantity: quantity,
price: price,
subtotal: subtotal,
});
}
console.log(ordered_items);
//I don't have an idea how to retrieve each item inside this variable /*ordered_items*/
[<>]snippet editor and post a minimal reproducible example