# A Deeper Look at Objects in JavaScript | kirupa.com

**URL:** <https://forum.kirupa.com/t/a-deeper-look-at-objects-in-javascript-kirupa-com/399321>\
**Category:** programming\
**Created:** [December 2, 2014, 1:48am UTC](https://forum.kirupa.com/t/a-deeper-look-at-objects-in-javascript-kirupa-com/399321 "2014-12-02T01:48:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [December 2, 2014, 1:48am UTC](https://forum.kirupa.com/t/a-deeper-look-at-objects-in-javascript-kirupa-com/399321/1 "2014-12-02T01:48:06Z")

</div>

by [kirupa](http://www.kirupa.com/me/index.htm) | 12 December 2013

In the [Introduction to Objects in JavaScript](http://www.kirupa.com/html5/introduction_to_objects_in_javascript.htm) tutorial, I provided a very high level overview of what objects in JavaScript are and how to think about them. In this tutorial, we will make that tutorial seem like the tip of a ginormous iceberg:

* * *
This is a companion discussion topic for the original entry at [http://www.kirupa.com/html5/a\_deeper\_look\_at\_objects\_in\_javascript.htm](http://www.kirupa.com/html5/a_deeper_look_at_objects_in_javascript.htm)

---

<div class="post-metadata">

**Author:** ![erolyil](https://avatars.discourse-cdn.com/v4/letter/e/7feea3/32.png) [@erolyil](https://forum.kirupa.com/u/erolyil)\
**Post date:** [February 3, 2015, 11:57am UTC](https://forum.kirupa.com/t/a-deeper-look-at-objects-in-javascript-kirupa-com/399321/2 "2015-02-03T11:57:53Z")

</div>

Hi Kirupa,

Thanks for this great article which will help many people understand the basics of object oriented programming in JavaScript.

I see that in your diagrams you mention that the [[Prototype]] properties of the objects instantiated references to the object created from which is not true in my opinion. Because when an instance of an object created by new(Constructor), the constructor’s prototype property is assigned to the [[Prototype]] property of that new object.

Example: salesman.prototype should refer to person.prototype (not person)

In other words there is no direct link between an instance and the object its instantiated (which maybe better to call as ‘constructor object’), they are connected by prototype.

instance -\> constructor.prototype -\> constructor

Thanks.

–  
Erol

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [February 3, 2015, 1:02pm UTC](https://forum.kirupa.com/t/a-deeper-look-at-objects-in-javascript-kirupa-com/399321/3 "2015-02-03T13:02:47Z")

</div>

> [@erolyil](#):
>
> In other words there is no direct link between an instance and the object its instantiated (which maybe better to call as ‘constructor object’), they are connected by prototype.
> 
> instance -\> constructor.prototype -\> constructor

There’s usually a direct link via the `constructor` property, or using the `instanceof` operator.

For example:

```javascript
var person = function(){}
var salesman = new person
salesman instanceof person // true
salesman.constructor == person // true
salesman. __proto__ == person.prototype // true

```

Glancing at Kirupa’s tutorial, it looks to me like you’re misinterpreting the diagram. Of course, there are always areas for improvement for Kirupa’s tutorials, so your point should be taken into consideration. The way I read k-man’s diagram is that `[[Prototype]]` references an object that _resembles_ each newly created Object.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [February 3, 2015, 6:59pm UTC](https://forum.kirupa.com/t/a-deeper-look-at-objects-in-javascript-kirupa-com/399321/4 "2015-02-03T18:59:56Z")

</div>

That diagram and/or supporting information can be made clearer, @erolyil 😄 Thanks for bringing that up - I’ll revise it shortly!

---

<div class="post-metadata">

**Author:** ![erolyil](https://avatars.discourse-cdn.com/v4/letter/e/7feea3/32.png) [@erolyil](https://forum.kirupa.com/u/erolyil)\
**Post date:** [February 3, 2015, 7:10pm UTC](https://forum.kirupa.com/t/a-deeper-look-at-objects-in-javascript-kirupa-com/399321/5 "2015-02-03T19:10:17Z")

</div>

Hi again,

> [@krilnon](#):
>
> The way I read k-man’s diagram is that [[Prototype]] references an object that resembles each newly created Object.

This is the point I am objecting already.

> [@krilnon](#):
>
> salesman.constructor == person // true **// salesman doesn’t has its own ‘constructor’ property, but salesman.prototype which is identical to person.prototype has.**

```
'constructor' in salesman // true
salesman.hasOwnProperty("constructor") // false

```

When you define an object actually two objects are defined. ‘Person’ and ‘Person.prototype’. When a new instance of an object created with new(Constructor), a single object gets created, for example ‘salesman’. ‘salesman’ has a ‘reference variable’ property called [[Prototype]] pointing to the constructors protoype for example ‘Person.prototype’ who has a contructor reference variable pointing to the constructor function, Person() in that case.
