Accessing Object Properties III 5/15


Creating a topic for the first time here, so forgive me if I made any mistakes. I am getting an error message.

I am getting this error message: " Did you write an if condition that checks if the day is Saturday, or is Sunday and if so, sets the alarm variable to ‘weekendAlarm’?"

let person = {name: 'Sachin', age: 24, weekendAlarm: 'No alarms needed', weekAlarm: 'Alarm set to 7AM'};
let day = 'Sunday';
let alarm;
if(day === 'Saturday' || day === 'Sunday')
  alarm = 'weekendAlarm';
  alarm = 'weekAlarm';


okay, the exercise seems to have trouble validating your code because you didn’t put if(day === 'Saturday' || day === 'Sunday') and { on the same line, it should be:

if(day === 'Saturday' || day === 'Sunday') {

same for else, there is nothing wrong with the way you put your curly brackets, but the exercise can’t validate it correctly for some reason


Typing the if(day ==='Saturday' || day === 'Sunday') and { on the same line fixed the issue. I type it on the next line because it’s less confusing for me if I type that way, it should actually work but it’s not. Codecademy should fix this.


good to hear you solved it :slight_smile:

Then you should make a bug report


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.