获取当前所有的属性

 1 Person = Backbone.Model.extend({

 2     defaults: {

 3         name: 'Fetus',

 4         age: 0,

 5         children: []

 6     },

 7     initialize: function() {

 8         console.log('欢迎来到这个无蛋的世界!');

 9     }

10 });

11 

12 var person = new Person({

13     name: 'Thomas',

14     age: 67,

15     children: ['Ryan']

16 });

17 var attributes = person.toJSON();

18 console.log(attributes);

19 console.log(JSON.stringify(attributes));

你可能感兴趣的:(属性)