DEV Community

Pankaj Singh
Pankaj Singh

Posted on

🎯 Objects in JavaScripts

In simple words objects is the collection of name-value pairs. Objects is JavaScript are same as dictionaries in Python , hashtable in c and c++ and hashmap in Java.
The "name" part is a JavaScript string, while the value can be any JavaScript value

There are two ways of creating the object
1 - using object literal (more convenient)
2 - using new keyword
πŸ‘‡

Image description

A simple example

Image description

Top comments (4)

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ • Edited

There's also Object.fromEntries and Object.create

Collapse
 
pankaj_singhr profile image
Pankaj Singh

yeah there is but idea of this post to just get an idea what are objects
sure i will add them in future

Collapse
 
suhakim profile image
sadiul hakim

Next time talk about class is js

Collapse
 
pankaj_singhr profile image
Pankaj Singh

sure