Meal

Can i know why we got to wrap itemName with square brackets inside getPrice function ?

const menu = { burger: 10, fries: 3, coleslaw: 4, coke: 2, beer: 5};

function getPrice(itemName, menu){
const itemPrice = menu[itemName];
return itemPrice;
}

const priceOfBurger = getPrice(‘burger’, menu);

console.log(priceOfBurger);

Suggest go back and restudy the unit on objects and how we access values by their keys using bracket notation.