Created
March 15, 2016 06:16
-
-
Save black-black-cat/d256ce6dea8e92697f5e to your computer and use it in GitHub Desktop.
修改原型上的属性
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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