JSON Parser with JavaScript[转]
Write a function that takes in a string of valid JSON and converts it to an object (or whatever your chosen language uses, dicts, maps, etc).
//__proto__ var Mazey1 = { name: 'Mazey1', say: function(){ console.log('Hi, i\'m ' + this.name + '!'); } }; var Cherrie1 = { name: 'Cherrie1' }; Cherrie1.__proto__ = Mazey1; Cherrie1.say(); //Hi, i'm Cherrie1!
低版本IE不支持,不推荐使用。
"JavaScript 创建对象(继承和实例)"继续阅读