Last active
May 3, 2017 22:23
-
-
Save DmitryMyadzelets/7c147beb1f5b2bb799776b6c6a83c784 to your computer and use it in GitHub Desktop.
Zodiac sign
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
{ | |
"capricorn":"Capricorno", | |
"aquarius":"Acquario", | |
"pisces":"Pesci", | |
"aries":"Ariete", | |
"taurus":"Toro", | |
"gemini":"Gemelli", | |
"cancer":"Cancro", | |
"leo":"Leone", | |
"virgo":"Vergine", | |
"libra":"Bilancia", | |
"scorpio":"Scorpione", | |
"sagittarius":"Sagittario" | |
} |
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
{ | |
"capricorn":"Козерог", | |
"aquarius":"Водолей", | |
"pisces":"Рыбы", | |
"aries":"Овен", | |
"taurus":"Телец", | |
"gemini":"Близнецы", | |
"cancer":"Рак", | |
"leo":"Лев", | |
"virgo":"Девы", | |
"libra":"Весы", | |
"scorpio":"Скорпион", | |
"sagittarius":"Стрелец" | |
} |
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
// Returns string of Zodiac sign given a day [1..31] and a month [0..11] | |
function zodiac(day, month) { | |
var sign = ['capricorn', 'aquarius', 'pisces', 'aries', 'taurus', 'gemini', 'cancer', 'leo', 'virgo', 'libra', 'scorpio', 'sagittarius']; | |
var last_day = [19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20]; | |
month += (day > last_day[month]); | |
month %= 12; | |
return sign[month]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment