0

Am pm

JS - Please help: Given a number by user, if it’s greater than 12, the program should output PM. If not, AM My code won’t work function main() { var hour = parseInt(readLine(), 10); // Your code goes here if hour > 12: return ("pm") else: return ("am") }

30th Mar 2021, 2:10 AM
Daniel Lopez
1 Answer
+ 4
You're joining Javascript with python here. In Javascript, if-else statements should be like this if (condition){ console.log(output) } else{ console.log(output) } AM, PM should be uppercase 12h should be included in PM
30th Mar 2021, 3:41 AM
Simba
Simba - avatar