I am trying to loop through a nested array but not able to display. I am new to Javascript any help would be appreciated. Thank you
let shoppingList = [
['Shirts', 'Pants', 'Tie', 'Belt'],
['Fruits', 'Vegetables', 'Spices', 'Utensils'],
['Toilet paper', 'Washing liquid', 'Brushes', 'Sponges']
];
//accessing the above array using for loop
for(let shoppingIndex=0; shoppingIndex < shoppingList.length; shoppingIndex++) {
document.querySelector('p').innerHTML = shoppingList(shoppingIndex);
}
<p> </p>
[ ]) to read an item from an array, i.eshoppingList[shoppingIndex]()you want to access it[]=>shoppingList[shoppingIndex]