Skip to content

Instantly share code, notes, and snippets.

@pazguille
Created January 31, 2022 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pazguille/4fe3e09d8601091e58546c4d244b3394 to your computer and use it in GitHub Desktop.
Save pazguille/4fe3e09d8601091e58546c4d244b3394 to your computer and use it in GitHub Desktop.
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