Why the result of printing x using console.log is undefined?
Update:
This is not a duplicate. I'm trying to understand why console.log doesn't print.
So I dig a little bit and I found something that could of happen to you.
when you open your Dev Tools, you have this little icon on the left: 
if you clicked on it, it will open a sidebar and if you are marking one of the two options that I point, it will not show the console.log print.
Change to the first selection, and you'll find out that you get the print. 
undefined although the message count is increasing after each print.Logging to the console is a redundant action in devtools, since it is bound to output to the console any values that are passed to it.
x Is the proper way to print the value of x to the console.
console.log(x) Is basically the same as writing
console.log(console.log(x)) Which returns undefined. Though, if you have an active debugger, it will evaluate and also print the value
console.log(x), so it should display the value of x and then return undefined. But all he sees is the returned value.console.log to print because I can't log inside a function as you suggest.I found an answer here: Chrome: console.log, console.debug are not working:
By @Tim:
Same issue, but I just cleared my settings. I went into Settings > Preferences and Clicked [Restore defaults and reload]. Just remember what your settings were.
console.log(x), I get123(x), thenundefined(since console.log() doesn't return anything)console.log(x)would have been123(newline)undefinedxgets printed usingconsole.log?