Constructor means it is supposed to be used for constructing something (object). So, when you need to create multiple objects then you can use constructors. Both are basically same, but when you call a function with 'new' keyword, it is called a constructor.
What is difference between regular Fun and Constructer Function with real time Example
Constructor means it is supposed to be used for constructing something (object). So, when you need to create multiple objects then you can use constructors. Both are basically same, but when you call a function with 'new' keyword, it is called a constructor.