javascript_core阅读笔记(四)
本系列内容是阅读javascript_core的笔记,原文见http://abruzzi.iteye.com/
18. javascript中的引用始终指向最终的对象,而并非引用本身。
var base = {name : "base",getInfo : function() {return this.name;}}var ext1 = {id : 0,__proto__ : base}var ext2 = {id : 9,__proto__ : base}alert(ext1.id);alert(ext1.getInfo());alert(ext2.id);alert(ext2.getInfo());
以上代码在firefox下可以跑,在ie下则有js错误