0

Exercise “Male or female”

Please tell me the solution options. Language does not matter Determine if the sex of the offspring will be male or female based on the X or Y chromosome present in the male's sperm. If the sperm contains the X chromosome, return "Congratulations! You're going to have a daughter."; If the sperm contains the Y chromosome, return "Congratulations! You're going to have a son.";

18th Apr 2018, 9:30 AM
Vitya Hook
Vitya  Hook - avatar
1 Odpowiedź
+ 2
JS: something like this const x; const y; function getSex(chromosome) { if (chromosome === x) { alert("Congratulation! You're going to have a daughter!"); } else if (chromosome === y) { alert("Congratulations! You're going to have a son!"); } }
18th Apr 2018, 11:24 AM
xphnx
xphnx - avatar