Created
January 31, 2022 20:30
-
-
Save pazguille/4fe3e09d8601091e58546c4d244b3394 to your computer and use it in GitHub Desktop.
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 signs = { | |
1: day => day <= 19 ? 'capricorn' : 'aquarius', | |
2: day => day <= 18 ? 'aquarius' : 'pisces', | |
3: day => day <= 20 ? 'pisces' : 'aries', | |
4: day => day <= 19 ? 'aries' : 'taurus', | |
5: day => day <= 20 ? 'taurus' : 'gemini', | |
6: day => day <= 20 ? 'gemini' : 'cancer', | |
7: day => day <= 22 ? 'cancer' : 'leo', | |
8: day => day <= 22 ? 'leo' : 'virgo', | |
9: day => day <= 22 ? 'virgo' : 'libra', | |
10: day => day <= 22 ? 'libra' : 'scorpio', | |
11: day => day <= 21 ? 'scorpio' : 'sagittarius', | |
12: day => day <= 21 ? 'sagittarius' : 'capricorn', | |
} | |
function getHoroscopeSign(day, month) { | |
return signs[month](day); | |
}; | |
console.log(getHoroscopeSign(28, 5)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment