var a = {};
console.log(a.__proto__); // shows the base object
console.log(a.__proto__.__proto__); // shows the prototype of the base object as "null".
Why isn't it undefined (as it is never declared as a property in the base object)?
null indicates an intentional absence of a value, typically of an object value. From the spec:
null value
primitive value that represents the intentional absence of any object value
In contrast, for undefined it says:
undefined value
primitive value used when a variable has not been assigned a value
Object.prototype's prototype is intentionlly set to indicate that there's no prototype, and separately prototype objects are, well, objects, so null for "no object" makes the most sense.
That said, beware of "why" questions with JavaScript, because although most of them have perfectly reasonable explanations, some of the most odd things just come down to "Because that's what Brendan Eich thought he should do at the time" and/or "Because there was a bug in the original implementation that got copied by other implementations and couldn't be changed without breaking existing code, so it had to be put in the spec." (For instance, that's why typeof null is "object" rather than "null".) I'm not saying don't ask "why" questions, because again, often there's a good reason that can lead to a better understanding of the language. Just beware that sometimes, well, there just isn't.😀