O'Reilly logo
  • Ricardo CastaƱeda thinks this is interesting:

sorted = new Movies(movies.sortByTitle());


Cover of Full Stack Web Development with Backbone.js


I get "movies.sortByTitle is not a function", --- I'm not sure if it's my mistake. In book there doesn't say to create a file to sort by title, but in github sortByTitle has its own js file. https://github.com/pipefishbook/ch_5/tree/master/sorting_fun/app/collections ---- to make sortByTitle work from Movies collection I had to require collection/movies and export Movies from main.js, then in console, add: var app = require('app'); var raw = require('raw');

var movies = new app.Movies(raw); var sortedBy = new app.Movies(movies.sortByTitle()); sortedBy.each(function(movie) { console.log(movie.get('title')); });