I have added Firebug in my browser. Why am I getting the output as undefined when I type the following in the terminal of Firebug?
console.log('Testing console');
I was expecting the text "Testing console" to appear.
And also, I have installed Firebug light in Chrome. How do I get the search box?
You should see both:
> console.log('Testing console');
"Testing console"
undefined
console.log
logs to the console, but doesn't return a value.
Try with
First type this
var testingString = 'Testing Console'
you will get undefined
later type this.
console.log(testingString)
you will get 'Testing Console'
But, why you get always undefined
?
Well this is what happened first it runs testingString
which return "testing console"
string and followed it return value of console.log()
, which is "undefined"
.
If you don't want to get 'undefined' just type
"Testing console"
Hope you get the idea.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.