0

help with javascript

Time flies when you’re having fun. Given a clock that measures 24 hours in a day, write a program that takes the hour as input. If the hour is in the range of 0 to 12, output am to the console, and output pm if it's not. Sample Input 13 Sample Output pm this question And this code function main() { var hour = parseInt(readLine(), 10); // Your code goes here }

21st Jan 2022, 7:44 PM
slom slomi78
3 Answers
0
Are you completed lesson of if-else blocks, ..? If not, do it now. You can get idea..
21st Jan 2022, 8:06 PM
Jayakrishna 🇼🇳
0
no This is a lesson 1Logical Operators
24th Jan 2022, 12:56 AM
slom slomi78
0
Ok. You can use a ternary operator to check if input less than or equal to 12 or not. If yes, output "am" Else output "pm". If you don't know about ternary operator then it is in next lesson, complete it. If you not get it right then post your try here... Hope it helps...
24th Jan 2022, 4:31 PM
Jayakrishna 🇼🇳