Sign in
Log inSign up

Constructor function vs Object Literal?

Madhankumar's photo
Madhankumar
·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?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct