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 }
3 Answers
0
Are you completed lesson of if-else blocks, ..? If not, do it now. You can get idea..
0
no This is a lesson
1Logical Operators
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...