Tuesday, June 4, 2024
 Popular · Latest · Hot · Upcoming
34
rated 0 times [  37] [ 3]  / answers: 1 / hits: 57162  / 12 Years ago, thu, january 31, 2013, 12:00:00

Every time console.log is executed, a line saying undefined is appended to the output log.


It happens in both Firefox and Chrome on Windows and Linux.


More From » debugging

 Answers
35

If you're running console.log() from a JS file, this undefined line should not be appended.



If you're running console.log() from the console itself, it makes sense. This is why: In the console you can type a name of a variable (for example try typing window) and it prints info about it. When you run any void function (like console.log) from the console, it also prints out info about the return value, undefined in this case.



I tested both cases on my Chrome (Mac ver 23.0.1271.101) and indeed I see the undefined line when I run it inside the console. This undefined also appears when I write this line in the console: var bla = sdfdfs


[#80495] Wednesday, January 30, 2013, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leannjaidynd

Total Points: 111
Total Questions: 100
Total Answers: 94

Location: Slovenia
Member since Wed, Apr 6, 2022
2 Years ago
;