30 lines
319 B
JavaScript
30 lines
319 B
JavaScript
|
|
|
|
function a() {}
|
|
|
|
b = function() {}
|
|
|
|
typeof a;
|
|
typeof b;
|
|
|
|
aclass = function () {
|
|
// this.foo = 1;
|
|
this.setFoo(1);
|
|
return this;
|
|
}
|
|
|
|
typeof aclass;
|
|
|
|
aclass.prototype.setFoo = function (v) {
|
|
this.foo = v;
|
|
}
|
|
|
|
anObject = new aclass() ;
|
|
|
|
anObject.setFoo(2);
|
|
|
|
anObject.foo;
|
|
|
|
// anobject = aclass();
|
|
|
|
// anobject.setFoo(3);
|