Created
November 15, 2011 02:57
-
-
Save henriquegogo/1365995 to your computer and use it in GitHub Desktop.
Get and Set with JavaScript
This file contains hidden or 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
var o = { | |
set item (str) { | |
return this.log[this.log.length] = str; | |
}, | |
get item () { | |
if (this.log.length > 0) { | |
return this.log[this.log.length - 1]; | |
} | |
else { | |
return null; | |
} | |
}, | |
log: [] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment