---
title: Object Creation in JavaScript
description: Here's what you need to know about the different ways to create objects in JavaScript and the resulting prototype chain for each method.
image: https://blog.avenuecode.com/hubfs/js-1.png
---

[AvenueCode.com](https://avenuecode.com) [News](https://avenuecode.com/news) [Contact](https://avenuecode.com/contact)

[![Avenue Code Snippets Logo](https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/AC-Snippets---Black.png)](https://blog.avenuecode.com/?hsLang=en-us) *menu*

- Technology
  
  [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us) [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us) [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us) [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us) [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
  
  [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us) [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us) [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us) [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

- [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us)
- [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us)
- [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us)
- [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us)
- [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us)
- [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us)
- [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us)
- [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

# [Object Creation in JavaScript](https://blog.avenuecode.com/object-creation-in-javascript)

- [Tweet](https://twitter.com/share)

*perm\_identity* [Rafael Bicalho](https://blog.avenuecode.com/object-creation-in-javascript/author/rafael-bicalho?hsLang=en-us)

*schedule* 3/13/19 3:00 PM

In our last article, we talked about [Prototype Inheritance in Javascript](https://blog.avenuecode.com/prototype-inheritance-in-javascript?hsLang=en-us). Today, we’ll take a look at the different ways to create objects in JavaScript and the resulting prototype chain for each method.

Almost all objects in Javascript are inherited from `Object`, which sits on top of the prototype chain. The prototype of `Object.prototype` is `null:`

 

##### 1. Object Literal

The simplest way to create an object is to use the object literal notation. The created object has `Object.prototype` as its prototype.

The prototype of `Object.prototype` is `null`, so the prototype chain is:

```
x ➞ Object.prototype ➞ null
```

##### 2. Constructor Functions

Sometimes you'll want to create multiple objects with the same properties. In JavaScript, constructor functions are functions used to create objects when called with the `new` keyword. The first letter of a constructor function is capitalized by convention. So, if we create a constructor called `Person`, the prototype of the objects created will be `Person.prototype`.

The resulting prototype chain is:

```
johnDoe ➞ Person ➞ Object.prototype ➞ null
```

 

##### 3. Object.create()

Because the previous structure looks so similar to classes in other languages, people expected it to behave like real classes, and that was not the case. So in an attempt to make object creation more intuitive in Javascript, ECMAScript 5 introduced `Object.create,`a static method that creates a new object from an existing object. The prototype of this object will be the first argument passed to the method.

The resulting prototype chain is:

```
johnDoe ➞ person ➞ Object.prototype ➞ null
```

 

#####  4. The C**lass** Keyword

As an option for using constructor functions, ES2015 introduced a cleaner and more convenient syntax by adding the **class** keyword (along with others like: super, extends, and constructor), but only as a syntactical sugar. JavaScript remains a prototype-based language and does not provide a class implementation of class-based languages like Java or C++. 

Here again, the prototype chain is:

```
johnDoe ➞ Person ➞ Object.prototype ➞ null
```

If you want to dive deeper into Javascript object creation, I highly recommend reading all about [new operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new),[ classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), and [Object.create()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create). 

Happy coding!

---

[![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Blog/linkedin.png)](https://www.linkedin.com/in/rbika/)

### Author

# Rafael Bicalho

 Rafael Bicalho is a UI Engineer at Avenue Code. He is a fan of technology, coffee and programming.

---

### Related Posts

### \[JAVA 21\] Structured Concurrency: Powering Data Orchestration with Virtual Threads and Scopes

[READ MORE](https://blog.avenuecode.com/java-21-structured-concurrency-powering-data-orchestration-with-virtual-threads-and-scopes?hsLang=en-us)

### How to Build Unit Tests Using Jest

[READ MORE](https://blog.avenuecode.com/how-to-build-unit-tests-using-jest?hsLang=en-us)

### How to Create Your Own RAR Extractor Using Electron

[READ MORE](https://blog.avenuecode.com/how-to-create-your-own-rar-extractor-using-electron?hsLang=en-us)

### How to Create a Tic-Tac-Toe Board Using React.js

[READ MORE](https://blog.avenuecode.com/how-to-create-a-tic-tac-toe-board-using-react.js?hsLang=en-us)

### Leave a Comment!

### Avenue Code Social

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Blog/facebook.png?t=1486470796564)](https://www.facebook.com/avenuecode)

[![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Blog/twitter.png?t=1486470796842)](https://twitter.com/AvenueCode)

[![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Blog/linkedin.png?t=1486470796556)](https://www.linkedin.com/company/avenue-code)

### Newsletter

Want to stay on top of all tips and news from Avenue Code?

### Popular Snippets

![Primary Logo AvenueCode Inverted.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Logos/Primary%20Logo%20AvenueCode%20Inverted.png?width=1104&name=Primary%20Logo%20AvenueCode%20Inverted.png "Primary Logo AvenueCode Inverted.png")

### About Us

- [Who We Are](https://www.avenuecode.com/who-we-are)
- [What We Do](https://www.avenuecode.com/what-we-do)
- [Portfolio](https://www.avenuecode.com/portfolio)
- [Partners](https://www.avenuecode.com/partners)
- [News](https://www.avenuecode.com/news)
- [Events](https://www.avenuecode.com/events)
- [Blog](https://blog.avenuecode.com/)
- [Contact](https://www.avenuecode.com/contact)

### Our Offices

San Francisco

[+1 415 766 4178](tel:+553125161448) [ac.inquiries@avenuecode.com](mailto:brazil.info@avenuecode.com)

Belo Horizonte

[+55 31 2516 1448](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

São Paulo

[+55 11 3205 3232](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

### We're Hiring!

- [Belo Horizonte](https://www.avenuecode.com/who-we-are)
- [New York](https://www.avenuecode.com/what-we-do)
- [San Francisco](https://www.avenuecode.com/portfolio)
- [São Paulo](https://www.avenuecode.com/partners)

---

©2015 - 2017 Avenue Code

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Icons/facebook-2.png)](https://www.facebook.com/avenuecode) [![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Icons/twitter-2.png)](https://twitter.com/AvenueCode) [![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Icons/linkedin-2.png)](https://www.linkedin.com/company/avenue-code) [![Glassdoor Icon](https://blog.avenuecode.com/hubfs/Images/Icons/glassdoor-icon-1.png)](https://www.glassdoor.com/Overview/Working-at-Avenue-Code-EI_IE456173.11,22.htm) [![YouTube Icon](https://blog.avenuecode.com/hubfs/Images/Icons/youtube-2.png)](https://www.youtube.com/user/AvenueCodePlay)

Please enable JavaScript to view the [comments powered by Disqus.](http://disqus.com/?ref_noscript)

© 2026 Avenue Code

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Rafael Bicalho",
    "url" : "https://blog.avenuecode.com/author/rafael-bicalho"
  },
  "dateModified" : "2019-03-13T18:00:06.788Z",
  "datePublished" : "2019-03-13T18:00:00.000Z",
  "headline" : "Object Creation in JavaScript",
  "image" : [ "https://blog.avenuecode.com/hubfs/js-1.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.avenuecode.com/object-creation-in-javascript",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/Avenue%20Code-primary%20versions_LOGO%20HORIZONTAL%20group%201-7.png"
    },
    "name" : "Avenue Code"
  }
}
```