This clock is odd | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

This clock is odd

I don’t understand why the input of 12 reads out “pm”. Any help would be appreciated function main() { var hour = parseInt(readLine(), 12); // Your code goes here time = hour >= 0 && hour <= 12 ? "am" : "pm" ; console.log(time) }

26th Sep 2022, 7:23 AM
JASONMAKS
2 Answers
+ 3
parseInt(readLine(), 12) readLine() is the input, not 12. The number is the base for conversion. You need base 10. Do not change the given input code.
26th Sep 2022, 7:38 AM
Lisa
Lisa - avatar
0
Thank you lisa. I muat have messed with it when i was making my own code, before i resulted to cheating lol
26th Sep 2022, 9:15 AM
JASONMAKS