This clock is odd | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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 Antworten
+ 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