Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

This little JavaScript object is a quick example for a Nettuts+ tutorial.

View MyObject.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
var MyObject = function (state) {
this._state = state;
}
MyObject.prototype.setState = function (state) {
this._state = state;
};
MyObject.prototype.addState = function (state) {
if (typeof this._state === "string") {
this._state = [this._state, state];
} else {
this._state.push(state);
}
};
MyObject.prototype.getState = function () {
return this._state;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.