Skip to content

Instantly share code, notes, and snippets.

@panfu
Created December 20, 2009 16:37
Show Gist options
  • Save panfu/260551 to your computer and use it in GitHub Desktop.
Save panfu/260551 to your computer and use it in GitHub Desktop.
OO.js
function obj(a) {
this.a = a;
this.b = getB();
function getB() {
this.c = 'this is c';
return 'this is b';
}
}
var o = obj('A');
o.a
o.b
o.c
var f = {
a: function() {
return this.b
},
b: "B here",
c: function() {
this.a();
this.b += "opopop";
return ;
}
}
f.a();
f.b;
f.c();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment