рони,
Всё дело в атрибуте configurable определяемом по наличию (declared) / отсутствию (undeclared) var:
Цитата:
|
Declared variables are a non-configurable property of their execution context (function or global). Undeclared variables are configurable (e.g. can be deleted). отсюда
|
Цитата:
|
The configurable attribute controls at the same time whether the property can be deleted from the object and whether its attributes (other than writable to false) can be changed. отсюда
|
Получается что (1) это (2):
// The 'x' is a non-configurable property of window
var x = 3; // (1)
Object.defineProperty(window, 'x', { value: 3, configurable: false, writable: true, enumerable: true }); // (2)
// The 'y' is a configurable property of window
y = 4; // (1)
Object.defineProperty(window, 'y', { value: 4, configurable: true, writable: true, enumerable: true }); // (2)