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));
转载于:https://www.cnblogs.com/qzsonline/archive/2012/08/16/2641847.html