I am trying to get the default values to use under a method. It seems like Model.get() cannot be used within the method itself. I have tried the two console.log, which displays the variable is not defined.
define(['jquery', 'Underscore', 'Backbone'], function($, _, Backbone){
var Game = Backbone.Model.extend({
//default values for the function
defaults: {
rows : 9,
cols : 8,
baseScore : 100,
numBlockTypes : 6,
baseLevelTimer : 60000,
baseLevelScore : 1500,
baseLevelExp : 1.05,
},
initialize: function(){
console.log(this.get(numBlockTypes));
//console.log(numBlockTypes);
}
}),
game = new Game;
return game;
});
Both @Elvis D’Souza and I came up with the same answer at the same time.
Need quotes