How Everything in JavaScript Is an Object

Everything is an object in JavaScript. In this post, you will learn about how everything is an Object. As one would simply observe it’s not quite as simple as some claim it to be (yet it is simple in the concept).

Finding Prototype Methods

In JavaScript, everything is an object. Let’s create an array:

let arr = ["Apple", "Orange", "Peach"];

This array has access to prototype methods. You can see this if you were arr.__proto__ in the console of your browser. You’ll get something like this:

arr.__proto__ console log

The prototype object in the prototype methods and values

The array has access to the prototype object methods and properties. However, if you take a look at the bottom, you’ll notice that you also have access to [[ProtoType]]: Object. So let’s do: arr.__proto__.__proto__

You’ll see here, that we are looking at the prototype object. All JavaScript objects link to a prototype object, which makes everything in JavaScript an object technically. Because now, since it inherits the prototype methods and values, we can now access it in different ways as though it was an object itself. Inheritance and the prototype chain allow us to do this, but that is outside the scope of this post.

So is everything an object? Yeah, it’s an object.