Skip to content

Instantly share code, notes, and snippets.

@nhunzaker
Created October 31, 2011 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhunzaker/1326714 to your computer and use it in GitHub Desktop.
Save nhunzaker/1326714 to your computer and use it in GitHub Desktop.
Article 1 - A simple tweet model with default values
// Creates a "Tweet" model based upon the Backbone.Model object
var Tweet = Backbone.Model.extend({
defaults: {
from_user : "natehunzaker",
text : "Grow you a #backbone for great good!"
}
});
// Instantiates the tweet model:
var myTweet = new Tweet();
console.log(myTweet.toJSON()); //= { from_user: "natehunzaker", text: "Grow you a #backbone for great good!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment