0

As of my knowledge, constructor function are just like normal functions (For convention we just uppercasing it). When we prefix it with new it becomes a constructor function which creates an object and returns it

function Foo(prop){
let this = {};
this.prop=prop;
return this;
}

Is this actually happens internally when we try to add a new keyword before any function.

Praveen
  • 3
  • 3

0 Answers0