-
-
Save codecademydev/ddb0557e915aa7dd133246e6edd8b20c to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getSleepHours = (day) => { | |
if (day === 'monday') { | |
return 8; | |
} else if (day === 'Tueday') { | |
return 4; | |
} else if (day === 'wednesday') { | |
return 6; | |
} else if (day === 'thursday') { | |
return 6; | |
} else if (day === 'friday') { | |
return 5; | |
} else if (day === 'saturday') { | |
return 7; | |
} else if (day === 'sunday') { | |
return 9; | |
} else { | |
return 'Error!' | |
} | |
}; | |
const getActualSleepHours = () => | |
getSleepHours('monday') + | |
getSleepHours('tuesday') + | |
getSleepHours('wednesday') + | |
getSleepHours('thursday') + | |
getSleepHours('friday') + | |
getSleepHours('saturday') + | |
getSleepHours('sunday'); | |
console.log(getSleepHours('monday')); | |
console.log(getActualSleepHours()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment