I started by looking at the localtodos
app and can see that this code makes it a function. I don't know how to make this choice. My assumption is that the code in the function is not run untill you call the function unlike and object literal which will be interpreted immediately.
Here is the use case:
var FavoritesRow = Backbone.Model.extend({
Name: 'FavoritesRow',
defaults: function () {
return {
url: "http://www.google.com",
title: "google",
favicon: "http://www.google.com/favicon.ico",
tag: "search"
};
}
});
But what rule / rules should I follow in general?