0

I have a chunk of code :

function Cons=function () {
    this.a='a';
}

var obj1 = New Cons;  //  {a: "a"}
var obj2 = New Cons(); // {a: "a"}

both obj1 and obj2 return same object, why ? I mean, what is the difference between creating object using New Cons and New Cons() ?

Mukund Kumar
  • 17,846
  • 17
  • 53
  • 77

0 Answers0