Skip to content

Instantly share code, notes, and snippets.

@black-black-cat
Created March 15, 2016 06:16
Show Gist options
  • Save black-black-cat/d256ce6dea8e92697f5e to your computer and use it in GitHub Desktop.
Save black-black-cat/d256ce6dea8e92697f5e to your computer and use it in GitHub Desktop.
修改原型上的属性
var fun = function(){
}
fun.prototype = {
info : {
name : 'peter',
age : 25
}
}
var a = new fun();
var b = new fun();
a.info.name = 'jack';
b.info.name = 'tom';
// 问题 a.info.name 与 b.info.name 分别是什么
// 答案 都是'tom'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment