1

When I am doing node REPL, I tried printing a statement on console like below. Along with the statement, it also printed undefined. How to understand this weird behaviour. Below is the code.

>console.log('Hello World!');
>Hello World!
 undefined
Ry-
  • 218,210
  • 55
  • 464
  • 476
rgk
  • 800
  • 1
  • 11
  • 32
  • 1
    It's the return value of `console.log()`. The console shows you the completion value for your script so you can just write `5 + 5` and get 10 back without needing a `console.log`, for example. – Ry- Mar 11 '17 at 11:32
  • cool. Thank you, got it. – rgk Mar 11 '17 at 11:40

0 Answers0