Created
June 19, 2022 12:05
-
-
Save Fanreza/6a74096bcf24f0ad13e88260dd8bf238 to your computer and use it in GitHub Desktop.
HackerRank WeekDay Text
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
function weekdaysText(weekdays) { | |
function getText(arr){ | |
if(arr > weekdays.length || arr < 0){ | |
throw new Error("Invalid weekday number") | |
} else{ | |
return weekdays[arr] | |
} | |
} | |
return getText | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment