I understand that any object that is created in JS has a hidden prototype object attached to it.

Basically yes. Every object has an internal property, denoted as [[Prototype]] in the specification, whose value is simply (a reference to) another object. That other object is the first object's prototype.

A prototype object itself is not hidden though, and you can explicitly set the prototype of an object, via Object.create:

var foo = {x: 42};
var bar = Object.create(foo);

console.log(bar.x); // 42
console.log(Object.getPrototypeOf(bar) === foo); // true
Run code snippetEdit code snippet Hide Results Copy to answer Expand

In this example, foo is the prototype of bar.

The prototype object is both a property of the parent object, and an object itself

First of all, there isn't only one prototype object. Any object can act as a prototype and there are many different prototype objects. And when we say "prototype object", we are really referring to an object that has the "role" of a prototype, not to an object of a specific "type". There is no observable difference between an object that is a prototype and one that isn't.

I'm not quite sure what you mean by "property of the parent object" here. An object is a not property, at most it can be the value of a property. In that sense, yes, an object that is a prototype must be the value of the internal [[Prototype]] property of another object.

But that is not much different than every other relationship between two objects (so nothing special). In the following example bar is an object and also assign to a property of foo:

var bar = {};
var foo = {bar: bar};

Is Object the same as prototype object?

No.

Object is (constructor) function for creating objects. var obj = new Object(); is the same as var obj = {};. However, using object literals ({...}) is more convenient which is why you are not seeing new Object used that much.

For every constructor function C, the following holds true:

Object.getPrototypeOf(new C()) === C.prototype

i.e. the value of the C.prototype property becomes the prototype of new instance of C created via new C.

Object.prototype is actually the interesting part of Object and the most important one. You may have heard about the "prototype chain". Because a prototype is just an object, it has itself a prototype, which is an object, etc. This chain has to end somewhere. Object.prototype is the value that sits at the end of basically every prototype chain.
There are many prototype chains because every value that is not a primitive value (Boolean, Number, String, Null, Undefined, Symbol) is an object (which includes functions, regular expressions, arrays, dates, etc).

If not, what is Object -- the global object?

See above. It's not the global object, the global object in browsers is window, and while every JavaScript environment must have a global objects, at least so far there is no standard way in the language to reference it (edit: I guess this in the global environment would one cross-platform way).

How does it/they relate to the window object or global object?

The only relation really is:

  • Object is a property of the global object, and thus a global variable.

You may think the global object's prototype is also Object.prototype, but that is not necessarily the case


Reading material:

  • You Don't Know JS: this & Object Prototypes ; all of gettify's books in the series are pretty awesome.
  • http://felix-kling.de/jsbasics/ ; shameless plug for some very concise slides that I created for a JavaScript class that I'm teaching from time to time. Might not be detailed enough to be useful on it's own (and contains typos ;) )
Answer from Felix Kling on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Extensions › Advanced_JavaScript_objects › Object_prototypes
Object prototypes - Learn web development | MDN
Every object in JavaScript has a built-in property, which is called its prototype. The prototype is itself an object, so the prototype will have its own prototype, making what's called a prototype chain.
🌐
Reddit
reddit.com › r/learnjavascript › can someone explain the concept of "prototypes" please.
r/learnjavascript on Reddit: Can someone explain the concept of "prototypes" please.
November 16, 2022 -

When reading docs on MDN I see lots of references like:

Array.prototype.forEach() or Object.prototype.toString()

Can someone explain to me what I need to know about prototypes and what it means in the above context please?

EDIT: Thanks everyone who replied. With your help I think it's starting to fall into place now.

Top answer
1 of 8
23
The short of it is: When you see something like Array.from() , it means the method is called from Array. Array.from(...) When you see something like Array.prototype.forEach() , it means the method is called from an instance of Array. const usesPrototype = new Array() usesPrototype.forEach(...) Array doesn't have access to prototype methods like forEach() and instances of Array don't have access to Array methods like from(). The prototype object is the separator that divides methods called from the class itself and instances of the class.
2 of 8
13
Every object is created by a function. let arr = [1, 2, 3, 4]; //this array gets created by the Array function. //new Array( ); // called to construct the array. Every function has a prototype object attached to it. The prototype object stores all the properties and methods that will be shared by all Array objects. arr.sort(); //the sort method is inside Array.prototype //this is why the documentation says Array.prototype.sort The prototype chain connects prototype objects that belong to different functions. At the top of the chain is the value `null`. You can create your own constructor function for your own custom object. It will automatically have a prototype object. It will then be connected to Object.prototype (the prototype object of the Object function). This way the objects that you create with your own custom object constructor function will have access to the methods inside that function's prototype plus Object.prototype. The `toString( )` method is actually inside of Object.prototype. Whenever you see an error message about an object not having a method or property of that name, it means that the javascript engine has walked up the prototype chain and reached `null` without finding the property. function MyCustomObj( ){ this.f1 = function( ){ console.log('f1'); } } MyCustomObj.prototype.f2 = function() { console.log('f2'); } Object.prototype.f3 = function() { console.log('f3'); } //with all the above defined we can do the following: let myobj = new MyCustomObj( ); myobj.f1(); myobj.f2(); myobj.f3(); //all three of these methods work. I have some tutorials I also made about prototypes too: https://www.youtube.com/watch?v=XoQKXDWbL1M https://www.youtube.com/watch?v=GhJTy5-X3kA https://www.youtube.com/watch?v=01jVgCK-HX4 https://www.youtube.com/watch?v=7C8xKTHd6Mw
Discussions

Object vs. Prototype in Javascript - Stack Overflow
I am trying to understand prototypes and dealing with some interference from my understanding of various other constructs. Can someone explain to me what Object is in Javascript? To clarify, I know More on stackoverflow.com
🌐 stackoverflow.com
Can someone explain to me in detail what exactly the prototype method means in Javascript?
I made http://objectplayground.com to answer this question in detail. :-) There's no easy way to answer this briefly, but I'll try: most objects have a [[Prototype]] that they inherit from. If you ask an object for a property that it doesn't have, JS will look for it in the [[Prototype]]. The [[Prototype]] is different from the prototype you use in your code, though. (E.g., "Dog.prototype.speak = function() {...}".) That prototype is a property, just like any other, on the Dog object. (In JavaScript, functions are objects.) When you create a function, it's created with three properties: name, length, and prototype. The function's prototype property shouldn't be confused with objects' [[Prototype]]. They're completely different. Here's the magic. When you use the new keyword, JS uses the function's prototype property to determine what the [[Prototype]] of an object should be. So if you say var chihuahua = new Dog(), then chihuahua's [[Prototype]] will point to the same object as Dog.prototype. And because JS looks at the [[Prototype]] when it can't find a property, you can call chihuahua.speak() and have it work. speak isn't defined in chihuahua, so JS looks at the [[Prototype]], which is the same as Dog.prototype, and runs speak from there. ... Meh... the video explains this way better. It has diagrams and everything, and an interactive visualizer for you to explore things yourself. More on reddit.com
🌐 r/javascript
28
56
August 30, 2013
Object Inheritance vs Class Inheritance vs Prototype Inheritance
You can just use the term "object inheritance". More on reddit.com
🌐 r/learnjavascript
7
2
October 22, 2023
Can someone explain the concept of "prototypes" please.
The short of it is: When you see something like Array.from() , it means the method is called from Array. Array.from(...) When you see something like Array.prototype.forEach() , it means the method is called from an instance of Array. const usesPrototype = new Array() usesPrototype.forEach(...) Array doesn't have access to prototype methods like forEach() and instances of Array don't have access to Array methods like from(). The prototype object is the separator that divides methods called from the class itself and instances of the class. More on reddit.com
🌐 r/learnjavascript
24
23
November 16, 2022
🌐
W3Schools
w3schools.com › js › js_object_prototypes.asp
JavaScript Object Prototypes
All JavaScript objects inherit properties and methods from a prototype.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › js-prototype
JavaScript Prototype - GeeksforGeeks
Prototypes define how objects share properties and methods. In JavaScript, a prototype acts as a shared blueprint that stores common methods and properties for objects of the same type.
Published: June 23, 2026
🌐
Medium
medium.com › @aniteshthakur › javascript-object-prototypes-20ed3478a7d6
JavaScript Object Prototypes. JavaScript, a versatile and widely-used… | by Aniteshthakur | Medium
November 29, 2023 - In this article, we’ll look into ... for objects. In JavaScript, a prototype is a mechanism through which objects inherit properties and methods from other objects....
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object
Object - JavaScript | MDN
Nearly all objects in JavaScript are instances of Object; a typical object inherits properties (including methods) from Object.prototype, although these properties may be shadowed (a.k.a. overridden).
Find elsewhere
🌐
DEV Community
dev.to › princam › javascript-object-prototypes-simply-explained-4cno
JavaScript Object Prototypes simply explained - DEV Community
May 24, 2023 - We learned what are the objects in JavaScript and that they can have properties with values. Property value can point to another object. Further, we found out that an empty object is not quite empty but has built-in methods in the prototype object. We can add properties to the prototype, it is called prototype chaining and it extends the original object.
🌐
DEV Community
dev.to › zachsnoek › understanding-javascript-prototypes-50c5
Understanding JavaScript Prototypes - DEV Community
November 17, 2021 - All JavaScript objects have a prototype, which is an object that it inherits properties from.
Top answer
1 of 1
9

I understand that any object that is created in JS has a hidden prototype object attached to it.

Basically yes. Every object has an internal property, denoted as [[Prototype]] in the specification, whose value is simply (a reference to) another object. That other object is the first object's prototype.

A prototype object itself is not hidden though, and you can explicitly set the prototype of an object, via Object.create:

var foo = {x: 42};
var bar = Object.create(foo);

console.log(bar.x); // 42
console.log(Object.getPrototypeOf(bar) === foo); // true
Run code snippetEdit code snippet Hide Results Copy to answer Expand

In this example, foo is the prototype of bar.

The prototype object is both a property of the parent object, and an object itself

First of all, there isn't only one prototype object. Any object can act as a prototype and there are many different prototype objects. And when we say "prototype object", we are really referring to an object that has the "role" of a prototype, not to an object of a specific "type". There is no observable difference between an object that is a prototype and one that isn't.

I'm not quite sure what you mean by "property of the parent object" here. An object is a not property, at most it can be the value of a property. In that sense, yes, an object that is a prototype must be the value of the internal [[Prototype]] property of another object.

But that is not much different than every other relationship between two objects (so nothing special). In the following example bar is an object and also assign to a property of foo:

var bar = {};
var foo = {bar: bar};

Is Object the same as prototype object?

No.

Object is (constructor) function for creating objects. var obj = new Object(); is the same as var obj = {};. However, using object literals ({...}) is more convenient which is why you are not seeing new Object used that much.

For every constructor function C, the following holds true:

Object.getPrototypeOf(new C()) === C.prototype

i.e. the value of the C.prototype property becomes the prototype of new instance of C created via new C.

Object.prototype is actually the interesting part of Object and the most important one. You may have heard about the "prototype chain". Because a prototype is just an object, it has itself a prototype, which is an object, etc. This chain has to end somewhere. Object.prototype is the value that sits at the end of basically every prototype chain.
There are many prototype chains because every value that is not a primitive value (Boolean, Number, String, Null, Undefined, Symbol) is an object (which includes functions, regular expressions, arrays, dates, etc).

If not, what is Object -- the global object?

See above. It's not the global object, the global object in browsers is window, and while every JavaScript environment must have a global objects, at least so far there is no standard way in the language to reference it (edit: I guess this in the global environment would one cross-platform way).

How does it/they relate to the window object or global object?

The only relation really is:

  • Object is a property of the global object, and thus a global variable.

You may think the global object's prototype is also Object.prototype, but that is not necessarily the case


Reading material:

  • You Don't Know JS: this & Object Prototypes ; all of gettify's books in the series are pretty awesome.
  • http://felix-kling.de/jsbasics/ ; shameless plug for some very concise slides that I created for a JavaScript class that I'm teaching from time to time. Might not be detailed enough to be useful on it's own (and contains typos ;) )
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Inheritance_and_the_prototype_chain
Inheritance and the prototype chain - JavaScript | MDN
JavaScript implements inheritance by using objects. Each object has an internal link to another object called its prototype. That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. By definition, null has no prototype and acts as the ...
🌐
NamasteDev
namastedev.com › home › technology & development › javascript › javascript prototypes explained
JavaScript Prototypes Explained - NamasteDev Blogs
May 1, 2025 - In JavaScript, every object has a prototype. A prototype is simply another object from which it can inherit properties and methods.
🌐
PortSwigger
portswigger.net › web-security › prototype-pollution › javascript-prototypes-and-inheritance
JavaScript prototypes and inheritance | Web Security Academy
Every object in JavaScript is linked to another object of some kind, known as its prototype. By default, JavaScript automatically assigns new objects one of its built-in prototypes.
🌐
Tektutorialshub
tektutorialshub.com › home › javascript › prototype in javascript
Prototype In Javascript - Tektutorialshub
February 18, 2023 - A Prototype is an object, which JavaScript assigns to the [[Prototype]] property of an object when it creates it.
🌐
Azuredays
azuredays.com › 2014 › 04 › 03 › object-javascript-understanding-prototypes-inheritance
Object JavaScript – Understanding Prototypes, Inheritance
April 3, 2014 - azuredays.com is for sale on Afternic. Get a price in less than 24 hours from our domain experts.
🌐
Pluralsight
pluralsight.com › blog › software development
JavaScript Prototype: Explanation & Examples | Pluralsight
Functions can be used to create class-like functionality in JavaScript; and all functions have a prototype property. That prototype property is somewhat like a class definition in other object-oriented langauge; but it is more than that. It is actually an instance of an object and every function in JavaScript has one whether you use it or not.
🌐
Juleshwar
juleshwar.dev › blog › dev › javascript.info-notes › object-prototype
Object Prototype
September 9, 2023 - Prototype methods, objects without ... or inherit behaviour from another object.[[Prototype]] is a hidden internal object field which is used to enable this....
🌐
Learnbatta
learnbatta.com › course › javascript › prototypes
Object prototypes in Javascript - learnBATTA
July 14, 2020 - Every object in JavaScript has a built-in property, which is called its prototype.
Top answer
1 of 5
35
I made http://objectplayground.com to answer this question in detail. :-) There's no easy way to answer this briefly, but I'll try: most objects have a [[Prototype]] that they inherit from. If you ask an object for a property that it doesn't have, JS will look for it in the [[Prototype]]. The [[Prototype]] is different from the prototype you use in your code, though. (E.g., "Dog.prototype.speak = function() {...}".) That prototype is a property, just like any other, on the Dog object. (In JavaScript, functions are objects.) When you create a function, it's created with three properties: name, length, and prototype. The function's prototype property shouldn't be confused with objects' [[Prototype]]. They're completely different. Here's the magic. When you use the new keyword, JS uses the function's prototype property to determine what the [[Prototype]] of an object should be. So if you say var chihuahua = new Dog(), then chihuahua's [[Prototype]] will point to the same object as Dog.prototype. And because JS looks at the [[Prototype]] when it can't find a property, you can call chihuahua.speak() and have it work. speak isn't defined in chihuahua, so JS looks at the [[Prototype]], which is the same as Dog.prototype, and runs speak from there. ... Meh... the video explains this way better. It has diagrams and everything, and an interactive visualizer for you to explore things yourself.
2 of 5
5
Among the other answers... if you are looking for the detailed explanation: http://www.ecma-international.org/ecma-262/5.1/#sec-4.2.1 In ELI5 form... imagine if you were building a car in a junk yard and you wanted to know what kind of door handle or engine to put on it... go to the prototype and use the one that exists there.
🌐
CodeBurst
codeburst.io › master-javascript-prototypes-inheritance-d0a9a5a75c4e
Master JavaScript Prototypes & Inheritance | by Arnav Aggarwal | codeburst
August 14, 2017 - All JavaScript objects have a prototype. Browsers implement prototypes through the __proto__ property and this is how we’ll refer to it. This is often called the dunder proto, short for double underscore prototype. Don’t EVER reassign this property or use it directly.
🌐
Playcode
playcode.io › javascript › prototype
JavaScript Prototype and Inheritance Guide | Playcode
Prototypes are the mechanism by which JavaScript objects inherit properties and methods from other objects.