示例1
输入
var C = function(name) {this.name = name; return this;};
var obj1 = new C('Rebecca');
alterObjects(C, 'What\'s up'); obj1.greeting;
输出
What's up
JS答案
function alterObjects(constructor, greeting) {
if(typeof constructor != 'function') throw('alterObjects():arguments error, should be function');
constructor.prototype.greeting = greeting;
}