I have been reintroducing myself to Backbone.js and I thought I would post small snippets for reference.

// Bare model
var Person = Backbone.Model.extend({});

// Model with some default values
var Person = Backbone.Model.extend({
  defaults: {
    name: "unknown",
    drinks: "water"

// Model with some an initialize function
var Person = Backbone.Model.extend({
  initialize: function(){
   // This will be called every time a Person instance is made   

// instantiate a new person and pass in some properties
var ghost4hire = new Person({name: "Joe Padilla", drinks: "Beer" });

// set a property
ghost4hire.set({twitter: "@ghost4hire"});

// get a property

Related Articles