JSFiddle - React, Tailwind, and code Playground
by Cody Lindley
HTML
<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/jquery-2.0.2.js"></script>
<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/lodash.underscore.js"></script>
<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/backbone.js"></script>
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
var contact = new Backbone.Model(); //instantiate model instance
//set/edit data
contact.set({firstName:"John",lastname:'Doe',phone:'1-111-1111'});
//has firstName attribute, note, has returns true regardlless of attribute value
console.log(contact.has('firstName')); //logs true
//get data
console.log(contact.get('firstName')); //logs John
//unset data
contact.unset('lastname');
//verify data is unset
console.log(contact.has('lastName')); //logs false
//clear all data
contact.clear();
//verify clear
console.log(contact.attributes); //logs empty {}