How to use JSON to create object that Inherits from Object Type?

前端 未结 3 1109
忘了有多久
忘了有多久 2021-02-02 00:33

I know how to use JSON to create objects, but there doesn\'t seem to be away to use JSON to create an object that is of a specific object type.

Here\'s an example of an

3条回答
  •  耶瑟儿~
    2021-02-02 01:04

    You could allow new Person() to accept an object to populate attributes with as a parameter.

    var you = new Person({ firstName: 'Mike' });
    

提交回复
热议问题