My FeedDiscussionsHeadless CMS
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Constructor function vs Object Literal?

Madhankumar's photo
·Sep 4, 2017

I have used both. But still I couldn't understand clearly. I have read many blogs about that , what I have understood is we can use the constructor function by using new keyword (creating instance). While in the Object literal case we don't need that. Using Object literal is like singleton. I don't know whether I am correct or not. Please let me clear with these two things. When to use?