replace item by choosing row, column and item name
groceryList[][] = ""
2D array is an array of arrays, effectively creating a grid-like structure. Each element in the main array holds another array (row), forming rows and columns. This arrangement allows for representing tabular or grid-based data. Accessing elements in a 2D array involves specifying both the row and column indices. They provide a way to organize and manipulate structured data in a two-dimensional format within a single variable.
replace item by choosing row, column and item name
let fruits = ["apple", "orange", "banana", "mango", "lemon"];
let vegetables = ["tomato", "potato", "onion"];
let meats = ["chicken", "beef", "pork", "fish"];
let groceryList = [fruits, vegetables, meats];
for (let list of groceryList) {
for (let food of list) {
console.log(food);
}
}