0

Every time i see some javascript code on a website, I feel like typing and trying it out on the Chrome's developer's tool console instead of creating a javascript file and then opening it separately in the browser.

Like today, I was viewing Doug Crockford's Js lecture and kept simultaneously running test on whatever he was saying to cross check that feature.

A strange thing that I noticed in the javascript console is that it always outputs the value undefined as a result of any statement that I execute that does not produce a fixed value as below:

var x = 12; Console o/p < undefined

2+3 Console o/p < 5

+"46" < 46

What does the undefined value mean which Chrome dev console after every declaration.

Probosckie
  • 1,585
  • 4
  • 25
  • 40
  • Exact duplicate of [this](https://stackoverflow.com/q/14633968/465053) question. – RBT Sep 20 '17 at 02:56

1 Answers1

0

If you type it without "var", just

x = 12;

it will output 12; but in any case, this is a duplicate question of: Chrome/Firefox console.log always appends a line saying undefined and What does it mean if console.log(4) outputs undefined in Chrome Console?

Community
  • 1
  • 1
Zoran P.
  • 870
  • 1
  • 13
  • 16