Try to use console.log()
But it's always printting undefined
.
Try to use the solutions like Console.log IE9 issue it does not work as well.
In this IE11 document, there is the following sentence:
Last but not least, forget about console.log(). The new tools now support Tracepoints easily allowing you to monitor specific values the same way you would via console.log().
What does that mean? How to use console.log to print variable in IE11?
System: windows 7(VirtualBox IE images)
IE version:11
It seems console.dir()
is an option, but how about console.log()
? It is in the document, but why does not take effect?
Try to use console.log()
But it's always printting undefined
.
Try to use the solutions like Console.log IE9 issue it does not work as well.
In this IE11 document, there is the following sentence:
Last but not least, forget about console.log(). The new tools now support Tracepoints easily allowing you to monitor specific values the same way you would via console.log().
What does that mean? How to use console.log to print variable in IE11?
System: windows 7(VirtualBox IE images)
IE version:11
It seems console.dir()
is an option, but how about console.log()
? It is in the document, but why does not take effect?
2 Answers
Reset to default 10Even though it's an old question, yet still giving me headache recently when working with IE11.
Simple reason: console
object is not initiated unless devtools (i.e. pressing F12
in IE11) is opened.
So a workaround could be, open devtools before loading console.log()
.
In my case, console.log
is loaded when my page is ready, so I open devtools and refresh the page to view my log.
I recently ran into issues with console.log while running the most recent preview build of Windows 10. Below is the code I was trying to log. The log would say my objects functions, proto, and users were undefined. I could "work around" this by changing my version of IE to 9 or putting a breakpoint on console.log(). As far as I can tell, they have just made the console methods more strict to conform with this documentation.
The rules I follow now is to always use console.dir() when outputting objects/variables.
var PM = PM || {
users:[]
};
var User = (function($){
//Private Static Variables
//Constructor
function User(obj){
this.id = obj.id;
this.first = obj.first;
this.last = obj.last;
};
return User;
})(jQuery);
var John = new User({
id: 1,
first: 'John',
last: 'Hargis'
});
var Nicole = new User({
id: 2,
first: 'Nicole',
last: 'Hargis'
});
PM.users = {
1: John,
2: Nicole
};
window.console.log(PM); //Undefined
window.console.dir(PM); //Works
console.log()
will printundefined
, whileconsole.dir()
will not, why? – Kamel Commented Mar 11, 2014 at 3:06