JSFiddle - React, Tailwind, and code Playground

by vineet85

HTML

<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://dl.dropbox.com/u/16292713/js/backbone.js"></script>
<script src="http://dl.dropbox.com/u/16292713/js/underscore.js"></script>

JavaScript

var collection = new Backbone.Collection();

collection.add(new Backbone.Model({name: 'Vineet', age:16}));



collection.add([
    {name: 'Sue', age:1},
    {name: 'Vi', age:2}
    ]);



//collection.remove(collection.at(1));
//console.log(JSON.stringify(collection));

collection.on('add', function(model, col, options) {
     console.log('added '+ model.get('name') + ' at index ' + options.index);   
});

collection.add({name:'troy', age:1});
collection.add({name:'ney', age:1}, {at: 2});
collection.add({name:'Eric', age:1}, {at: 2, silent:true});