Object in javascript
Anonymous
let meal = 'none';
let time = 112;
// We'll use military time for this example, counting hours 0-23.
const restaurantSpecials = {
breakfast: 'The breakfast special is 20% off freshly squeezed orange juice',
lunch: 'The lunch special is 10% off appetizers',
none: 'There are no specials currently'
};
if (time < 11) { // 11 am
meal = 'breakfast';
} else if (time < 17) { // 5 pm
meal = 'lunch';
}
console.log(restaurantSpecials[meal]);
Here I am unable to understand that how meal is assigned the value of none ,I am unable to understand the if statement logic