0

Day or night?

-This version worked on Chrome, but not on SoloLearn? function main(hour){ if (hour >= 0 && hour<=12){ return "am"; }else{ return "pm"; } } console.log(main(12)); //Returned "am". console.log(main(14)); //Returned "pm". console.log(main(8)); //Returned "am".

5th Feb 2021, 8:41 PM
tristach605
tristach605 - avatar
4 ответов
+ 1
hour = +hour; // at start of main should work // (implicite to number conversion)
5th Feb 2021, 8:46 PM
visph
visph - avatar
+ 1
your code works on sololearn web code playground: https://code.sololearn.com/W1N8i6AhLcq0/?ref=app what do you expect as output?
5th Feb 2021, 8:50 PM
visph
visph - avatar
0
Pass number to function instead of string
5th Feb 2021, 10:56 PM
Bhavya
Bhavya - avatar
0
It only passes one number at a time and then tells me the other is an error? Is there a way to add a screen shot?
7th Feb 2021, 7:05 AM
tristach605
tristach605 - avatar