Object:
The object is a variable that can hold an multiple variables.
An object is a collection of key value pairs. It contains Information and Methods.
Object describe anything like House, People, Animals and other objects.
Example:
const pen ={
colour:"red",
brand :"cello",
price :15,
write :function(){
console.log("writing")
}
}
ARRAY:
An array is a special type of object used to store ordered, Indexed values.
It is a zero indexed because it starts array[0].
It can shrink elements add and remove so it is a Dynamic size.
It is a Heterogeneous so it can stores Numbers, Strings.
Example:
const cars =["saab","volvo","bmw"]
console.log(cars[0])
cars[3]="ford"
Top comments (0)