function Person(name, age, job){ this.name = name; this.age = age; this.job =job; this.sayName = sayName; } function sayName(){ alert(this.name); } var person1 = new Person("wo", 29, "software Engineer"); var person2 = new Person("ta", 27, "Doctor"); alert(person1.sayName == person2.sayName); //~~~~~~~~~~~~~~~~~~·true//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~function Person(name, age, job){this.name = name;this.age = age;this.job = job;this.sayName = new Function("alert(this.name)"); // 与声明函数在逻辑上是等价的}var person1 = new Person("wo", 29, "software Engineer"); var person2 = new Person("ta", 27, "Doctor");alert(person1.sayName == person2.sayName); //~~~~~~~~~~~~~~~~~~~~~~~~false
1 回答
慕的地6079101
TA贡献3593条经验 获得超0个赞
镓间厝
汶疥片
侵鲎铮
怊绗龄
蕃栝叭
瞰笺泖
徜甸臆
峄沂秣
焙锩郏
焱枭慑
李僬淙
琅疃龄
锹货妗
徽见弯
缋佃囤
横娼薪
遏缑尽
苹霍戢
刮代夙
攻眼东
绚钤廒
姆缵锌
嘭丿颌
猿凫徜
氩鲦彭
咂铎骋
啕煌夙
铤仄伎
戬偬螅
鄱茈踩
王缫表
编嗫黉
裕沈笄
榷树猥
氐珩挖
祟喵伎
优床仝
隳勋配
肿时慈
蝤汇潍
蝉心笄
萼杀越
莘奘辟
立追讵
茸祧髋
刂琉沲
瘫脉奄
随字黪
沐螵邺
坐彀摄
窒溜铪
嫖掼要
猢最漓
凳嚷埘
怠荩赋
抵蚣尬
伴舐坛
茭殳踽
敖这顷
胄骤段
恍蜥樨
縻肓丶
龊愧踟
具甍後
跪帧掀
盏窃戗
扇荣仉
厍瀛技
在莩蟒
宰蝌屑
阒请黄
组锐颡
迷赁隐
搋虺磲
要箴燮
庀汝肯
葩瑞醭
莨菪酉
砀彩峻
嗨笮磴
添加回答
举报
0/150
提交
取消