编辑代码

function createObject(o) {
	var clone = Object.create(o);
	// 扩展对象方法
	clone.sayHello = function() {
        console.log('Hello, i am', this.name);
    };
	// 返回该对象
	return clone;
}

var person = {
    name : 'David',
    age: 36,
    hobbies: ['PC game', 'music', 'drawing']

};

var anotherPerson = createObject(person);
anotherPerson.name = 'Allen';
anotherPerson.sayHello();
anotherPerson.hobbies.push('running');

console.log(person.hobbies);