0

considering:

function C() {
  var v=5;
  
  function getV() { return v; }
  
  return {
    getV: getV
   }
 }

var o1=new C();
alert(o1.getV());

var o2=C();
alert(o2.getV());

As both versions produce the same result

  • what is the difference between the version using new and the version that doesn't ?

  • is any version better ?

kofifus
  • 11,635
  • 8
  • 73
  • 114

0 Answers0