Why 'NaN' and 'Undefined' are not reserved keywords in JavaScript?

javascript, keyword

Solution

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/NaN

NaN is a property of the global object.

The initial value of NaN is Not-A-Number — the same as the value of Number.NaN. In modern browsers, NaN is a non-configurable, non-writable property. Even when this is not the case, avoid overriding it.

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/undefined

undefined is a property of the global object, i.e. it is a variable in global scope.

The initial value of undefined is the primitive value undefined.

Problem

We can do: ``` NaN = 'foo' ``` as well as ``` undefined = 'foo' ``` Why are they not reserved keywords? I think it should be implemented in order to be sure that when we are looking for a `number`, it is a `number` :) If we should use `IsNaN()` or `typeof`, why are `NaN` or `undefined` needed?

Original source