Array & Object in JavaScript
Understanding JavaScript Arrays and Objects: A Beginner-Friendly Guide with Examples
Array :- An array is a single variable used to store multiple elements. JavaScript array are resizable and can contain a mix of different data types.
const myArray = ["name", true, 23, "surname", "india", 26573, false];Get Shubh Tiwari’s stories in your inbox
Join Medium for free to get updates from this writer.
Object :- An object in JavaScript is a collections of data. It stores data as key-value pairs, where each key is a unique identifier for the associated value. Objects are dynamic, which means the properties can be added, modified, or deleted at runtime.
const myObj = {
firstName : "Shubham",
lastName : "Tiwari",
age : null,
address : undefined,
profession : "Programmer, Youtuber",
income : 20000000,
greet : function (){
consle.log(`Hello Mr. ${this.firstName}`)
}
}


