0
Why isnt this code working
Okay im trying to make somthing that you type in your zodiac and it will tell you what animal you are but I ONLY WANT IT TO ALERT YOU OF THE ANIMAL IF IT MATCHES THE ZODIAC. var Taurus = "Fox"; var Aries = "Dog"; var Capricorn ="Bear"; var Libra = "Cat"; var Sagttarius = "Horse"; var Aquarius = "Dolphin"; var Pisces = "Turtle"; var Cancer = "Goat"; var Gemini = "Bird"; var Leo = "Lion"; var Virgo = "Bull"; var Scorpio = "Crab"; prompt ("Enter Zodiac"); if(prompt === Scorpio);{ alert ("Crab"); }
2 ответов
0
Error in code is, if(prompt === Scorpio) which is equivalent to, if(prompt === "Crab")
Here's how i would do it.
https://code.sololearn.com/WpRnAbxTZIbc/#js
story values in a dictionary using zodiac as key and animal as value
check if prompted animal exists in dictionary, if it does alert
0
Oh thank you im not that good with js but im learning so thank you for helping me.