开发者

the delete operator in javascript

I would like to ask questions about 'delete' operator in Javascript

Why

delete window.document; // returns false

but

delete navigator.geolocation; // returns true

I try other properties of navigator and it still returns true

I have checked the IDL in 开发者_Python百科webkit, document and navigator are both of readonly,

and they dont have DontDelete attribute but why I can delete one but not for the other???


If you'd like to understand the delete operator, wrap your mind around the javascript spec section 11.4.1

There are several cases where the operator should evaluate to true without mutating any objects.

From 8.12.7, the operator checks checks an internal [[Configurable]] property of the property descriptor to enforce readonly properties.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜