Steroids of JavaScript 🙇 | Curative Artist

Steroids of JavaScript 🙇

JavaScript stack is booming in the software development field. Node JS, Angular, React, Vue, Express and more are a game changer for modern development. It’s use in backend & frontend makes it a no lose bet for anyone. Today’s life of a software developer is incomplete without JavaScript and JavaScript is nothing without Object. So let’s learn about Object 🤩
Steroids Of Javascript
Steroids Of Javascript

📣  This is Part 1

What is Object in JS?

Objects are variables which can be used to store multiple values in the form of key-value pairs. It is a Non-Primitive data type….Let’s see it as a programmer 🧑‍💻 and break it down.


How to create this god variable of Javascript.

const hard_work = new Object()   ; //Output: {}
const smart_work = {}  ; //Output: {}

We just created this god variable but it does not contain anything. So let’s put some super powers into it.

Added Key-Value pair to object

// Super charged Object...
const obj = {
name : "Adarsh Kumar",
age : 21,
coder : true,
fav : ['coding','games'],
greeting : function(){ return `Hello `+  },
code  : {
      react : "Sometime",
      reactnative : "always"
console.log(obj.age)    // Output: 21

So we added some key-value to our empty object to give it a super power. We can add string, boolean, integer, array, function and even objects to objects 🤯.  


Object is a Non-Primitive data type, which basically means that we store reference of variable not it’s value. If you don’t get it then no worry, code will explain it much better to you than me 😅.

// Let see the Primitive first

let name="Adarsh"; // Value `Adarsh` is stored to the name variable
let obj={ age : 20 }; // This time is Reference is stored in the obj. For eg. #76123ghsd (any ref id)

Okay… But how is it special or different. I don’t see anything interesting?  Woah… Woah… coders this is really interesting and hold on a bit.

// How references affect in code.

// First let’s see the behaviour of primitive data type

let name="Adarsh";
let new_name=name;

console.log(new_name) // Output: Adarsh

// Not let’s check how object will behave
let obj={
     name : "Adarsh"

let new_obj = obj; = "Phoolan"
console.log(new_obj)  // Output is {name:”phoolan”}

In primitive data types like string, integer or boolean in JavaScript once assigning data to the new variable and changing the data of old variable does not cause any side effect on new variable.

In Non-Primitive data types like objects or arrays, once assigning data to the new variable and changing the data of the old variable it also causes a side effect on the new variable. It is because reference of old variable is passed to the new variable, not it’s data.

🚧  Finish this part

That’s it for this part…. Now your job is to explore more on this and if you find something interesting in objects, write it on the comment section.