0
JavaScript pro question: Noon or Midnight…
Dear All, for this question, why we need to use “console.log(x)” at the end instead of “document.write(x)”? Many thanks! function main() { var hour = parseInt(readLine(), 10); // Your code goes here x = (0<=hour&&hour<=12)?"am":"pm"; console.log(x) }
3 ответов
+ 1
YANG Fei
We write console.log for debugging purpose which print anything on browser's console.
document.write used to show output on browser.
+ 2
In addition one thing. It should be written:
var x = …
This code is easy and very short, so the compiler added that for you and it works.
0
Hey Yang
Kavya
Kindly pls
Contact me at
suvarnapatil19085@gmail.com
I want some guidance from you