> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/advanced/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/advanced/17.-learn-backbone.js-tutorial-from-scratch-for-beginners-part-20-underscore-js-methods-in-backbone.md).

# 17. Learn backbone.js tutorial from scratch for beginners(Part 20) Underscore js Methods in backbone

![](/files/-MS6TicC1i9dh7owyM7k)

![](/files/-MS6zO629r7QQ8wWygbq)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
  	defaults: {
  		name: 'Lionel',
  		team: "Viet Nam",
  		no: 10
  	}
  });
  
  var model1 = new FirstModel({
  	name: 'Lionel 1',
  	team: "VietNam",
  	no: 16
  });
  var model2 = new FirstModel({
  	name: 'Lionel 2',
  	team: "India",
  	no: 17
  });
  var model3 = new FirstModel({
  	name: 'Lionel 3',
  	team: "Korea",
  	no: 18
  });
  var MyCollection =  Backbone.Collection.extend({
  	model: FirstModel
  });
  var MycollectionObj = new MyCollection([model1, model2, model3]);
  var ModelView = Backbone.View.extend({
  	collection: MycollectionObj,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		_.each(this.collection.toJSON(), function(model) {
  			console.log(model.name + " , " + model.team);
  		});
  	}
  });
  vmodel = new ModelView();
});
```

![](/files/-MS7-CvpIyRrkm-ttuHc)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
  	defaults: {
  		name: 'Lionel',
  		team: "Viet Nam",
  		no: 10
  	}
  });
  
  var model1 = new FirstModel({
  	name: 'Lionel 1',
  	team: "VietNam",
  	no: 16
  });
  var model2 = new FirstModel({
  	name: 'Lionel 2',
  	team: "India",
  	no: 18
  });
  var model3 = new FirstModel({
  	name: 'Lionel 3',
  	team: "Korea",
  	no: 18
  });
  var MyCollection =  Backbone.Collection.extend({
  	model: FirstModel
  });
  var MycollectionObj = new MyCollection([model1, model2, model3]);
  var ModelView = Backbone.View.extend({
  	collection: MycollectionObj,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		var data = _.where(this.collection.toJSON(), {no: 18});
  		console.log(data);
  	}
  });
  vmodel = new ModelView();
});
```

![](/files/-MS700zjN0_3vE_5E5qA)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
  	defaults: {
  		name: 'Lionel',
  		team: "Viet Nam",
  		no: 10
  	}
  });
  
  var model1 = new FirstModel({
  	name: 'Lionel 1',
  	team: "VietNam",
  	no: 16
  });
  var model2 = new FirstModel({
  	name: 'Lionel 2',
  	team: "India",
  	no: 18
  });
  var model3 = new FirstModel({
  	name: 'Lionel 3',
  	team: "Korea",
  	no: 18
  });
  var MyCollection =  Backbone.Collection.extend({
  	model: FirstModel
  });
  var MycollectionObj = new MyCollection([model1, model2, model3]);
  var ModelView = Backbone.View.extend({
  	collection: MycollectionObj,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		var data = _.findWhere(this.collection.toJSON(), {no: 18}); // retrun result first
  		console.log(data);
  	}
  });
  vmodel = new ModelView();
});
```

![](/files/-MS72XDFQu4dGSZR-AUq)

C:\Users\Administrator\Desktop\gulp\app.js

```
jQuery(document).ready(function($) {
  var FirstModel = Backbone.Model.extend({
  	defaults: {
  		name: 'Lionel',
  		team: "Viet Nam",
  		no: 10
  	}
  });
  
  var model1 = new FirstModel({
  	name: 'Lionel 1',
  	team: "VietNam",
  	no: 16
  });
  var model2 = new FirstModel({
  	name: 'Lionel 2',
  	team: "India",
  	no: 18
  });
  var model3 = new FirstModel({
  	name: 'Lionel 3',
  	team: "Korea",
  	no: 18
  });
  var MyCollection =  Backbone.Collection.extend({
  	model: FirstModel
  });
  var MycollectionObj = new MyCollection([model1, model2, model3]);
  var ModelView = Backbone.View.extend({
  	collection: MycollectionObj,
  	initialize: function() {
  		this.render();
  	},
  	render: function() {	
  		var data = _.pluck(this.collection.toJSON(), "name");
  		console.log(data); // return result first
  	}
  });
  vmodel = new ModelView();
});
```
