diff options
-rw-r--r-- | _posts/2011-01-29-what-is-a-model.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/_posts/2011-01-29-what-is-a-model.md b/_posts/2011-01-29-what-is-a-model.md index e967b50..ad5ffd6 100644 --- a/_posts/2011-01-29-what-is-a-model.md +++ b/_posts/2011-01-29-what-is-a-model.md @@ -13,15 +13,15 @@ Across the internet the definition of [MVC](http://en.wikipedia.org/wiki/Model%E So for the purpose of the tutorial let's create a model. -{% highlight javascript %} - Person = Backbone.Model.extend({ +```js + var Person = Backbone.Model.extend({ initialize: function(){ alert("Welcome to this world"); } }); var person = new Person; -{% endhighlight %} +``` So _initialize()_ is triggered whenever you create a new instance of a model( models, collections and views work the same way ). You don't have to include it in your model declaration but you will find yourself using it more often than not. |