javascript - Backbone model initialization -


I am studying the spinal cord and I am trying to initialize an object but the result of the console In the form I get a blank object. What am i doing wrong

Month = Backbone.Model. Extension ({Month: "A", Value: [[label: "total", value: 0}, {label: "expenditure", value: 0}, {label: "profit", value: 0}]}) ; Var x = new month (); Console.log (x.toJSON ())

A backbone.model is an object, you can not start it with an array.

But you can start it with an object like this:

  Month = Backbone.Model.extend ({default: {label: "total", month: "A", value: 0}}); Var x = new month (); Console.log (x.toJSON ())  

Comments