javascript下原型的疑问
var a = {};//a普通object对象
alert(typeof a==='object' && a instanceof Object);//打印true,不用证明,他当然是object对象了
alert(a);//[object,object]
alert(a.prototype);//undefinded,那么这里为什么没有prototype属性??????,难道只有Function对象只有prototype属性,不过根本说不通
var b = function(){};
alert(b);//[object,object]
alert(b.prototype);//[object,object]
Object.prototype.test= function(){
alert(1);
}
String.test();//如果说Object 对象不具有prototype属性,那么这里就不应该能打印出来1,普通的Object对象也有prototype属性
我的问题是:a既然也是一个object对象那么为什么不具有prototype属性,如果定义一个a,要使用Object。prototype进行原型扩展的话,岂不是给所有的对象都强加上了一个新方法?