jjzjj

javascript - 函数对象原型(prototype)

这个问题在这里已经有了答案:HowdoesJavaScript.prototypework?(26个答案)关闭7年前。functionfuncObj(){}funcObj.prototype.greet="hello";console.log(funcObj.greet)//undefined???console.log(funcObj.prototype.greet)//hellovarobj=newfuncObj();console.log(obj.greet);//hello根据我对原型(prototype)的理解。如果您访问一个对象的成员,它将在该对象中不可用时从原型(prot