简体   繁体   English

IE9和更低版本下IE11中console.log()的错误

[英]A bug of console.log() in IE11 under IE9 mode and below

I found console.log() in IE11 under IE9 mode and below works wierd. 我在IE9模式下的IE11中发现console.log(),以下情况很奇怪。 If I create an empty object, then log it, it will show 'undefined', but by alerting it shows correctly. 如果我创建一个空对象,然后将其记录下来,它将显示“未定义”,但是通过警告它可以正确显示。 Is this happen to you guys, or just me? 这是发生在你们身上,还是发生在我身上?

var a ={};
a.b = false;
a.c = true;
console.log(a);  //undefined
console.log(a.b);  //undefined
console.log(a.c);  //true
alert(a); //[object Object]
alert(a.b); //false
alert(a.c); //true

I am not able to reproduce the issue using the F12 console in IE9 document mode. 我无法在IE9文档模式下使用F12控制台重现该问题。

Could you perhaps be looking at the return value instead of the printed message? 您能否查看返回值而不是打印的消息?

When you run the following code from the console: 当您从控制台运行以下代码时:

var a = {}; console.log(a);

It will print the message in blue: 它将以蓝色打印消息:

> [object Object] {}

And then display the return value to console.log in green: 然后以绿色显示console.log的返回值:

undefined

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM