Features

Pros

When to use Backbone?

Underscore.JS

When to use Underscore?

Samples

			
<script id="item-template" type="text/template">
	<div>
	   <input type="checkbox" id="todo_complete" <%= completed?'checked="checked"' : ''%>>
	   <%- title %>
	</div>
</script>

var TodoView = Backbone.View.extend( {
	tagName: "li";,
	todoTpl: _.template("item-template");,
	events: {
		'dblclick label':'edit',
		'keypress .edit':'updateOnEnter',
		'blur .edit':'close'
	},
	render: function() {
		this.$el.html(this.todoTpl(this.model.toJSON()));
		this.input = this.$('.edit');
		return this;
	}
});
		
Snippet 1: Backbone view & Templating