JavaScript — 3 Things you should know

Objects Edition

Vincent Collis
3 min readFeb 18, 2021

JavaScript may very well be the most popular programming language in use today. JavaScript’s ability to create web applications, front-end, back-end, and mobile applications with React Native makes it a dominant gene in the genetic pool of programming languages.

Objects, in JavaScript, is it’s most important data-type and forms the building blocks for modern JavaScript. These objects are quite different from JavaScript’s primitive data-types(Number, String, Boolean, null, undefined and symbol) in the sense that while these primitive data-types all store a single value each (depending on their types).

Objects can be very complex and each object may contain any combination of primitive data-types as well as reference data-types.

With that said, we must understand the basics of the language to create web applications masterfully. In this article, I’m going to share with you three things you should know about objects to be on the way to mastering JavaScript!

Object Destructuring

Destructuring is an amazing feature that was introduced in ES6. It’s one that I use all the time when organizing my props in React. It addresses DRY directly by being a remedy for accessibility and repetition.
With destructuring you “destructure” your object by declaring variables with the same name as keys in the object and setting it to the value of the object itself. JavaScript will then go through and match the key:value pairs and create the new variable with the corresponding value

References

In JavaScript, objects are stored in the heap memory. This is the space where variables can maintain a reference to specific data instead of a full copy of all the data in your application. For instance, when you have JS check for object equality, it is actually checking the reference, not the actual value of properties.

Constructors

Constructors are just functions that describe how to create an Object. One of the easiest ways to think of good functionality for this would be for a game application. Your app would have code giving it instructions on how to create a new char.

The object is easily instantiated with the new keyword.

--

--