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?