Cannot override value for undefined

Does Chrome prohibit changing the value for undefined? I just tried:

undefined = 3

But when upon request undefinedhe gives meundefined

PS. I will not redefine it in my code, I just wonder why it does not work.

+4
source share
1 answer

It is right. Most modern browsers prevent value changes undefined.

From Mozilla Docs :

In modern browsers (JavaScript 1.8.5 / Firefox 4+), undefined is unconfigurable, not writable in properties by the ECMAScript 5 specification. Even if it is not, avoid overriding it.

, undefined , .

+4

Source: https://habr.com/ru/post/1605679/


All Articles