Created
February 2, 2011 08:03
-
-
Save k33g/807392 to your computer and use it in GitHub Desktop.
use of "Annotations for js"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Human(){ | |
/* @@-FirstName- | |
myType:TEXT, | |
myDefaultValue:John | |
@@ */ | |
this.FirstName; | |
/* @@-LastName- | |
myType:TEXT, | |
myDefaultValue:Doe | |
@@ */ | |
this.LastName; | |
this.toString = function(){ | |
return this.FirstName+" "+this.LastName; | |
} | |
} | |
var h = new Human(); | |
console.log(Annotations(Human)); | |
h.FirstName = Annotations(Human)['FirstName']['myDefaultValue']; /*display John*/ | |
h.LastName = Annotations(Human).LastName.myDefaultValue; /*display Doe*/ | |
console.log(h.toString()); /*display John Doe*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment