开发者

Overwrite Object function didn't affect {} expression?

I overwrite the Object constructor:

function Object() {
    console.log("here");
}

when I call var x = new Object();, I can see "here".

However, when I call var x = {};, I can't got it.

开发者_运维问答Isn't {} the same as new Object()? How can I get this work?


using object() creates new function with name object with scope on document object, actually does not override object. While using var x = {}, it use original JS object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜