I used the Chrome Console to write a simple statement:
console.log(4)
and received the
Output:
4
undefined
What does the undefined statement mean?
Does the undefined statement imply correct execution? If I execute the statement via a separate html file and then look at the console, the output is just 4.
The
undefinedis the return value ofconsole.log(...).You can see this by defining two functions in the console, one returning something, and the other returning nothing, e.g. like this:
And then calling them separately (manually)
and
Also note the little symbol before these return value string.