How to access object prototype in javascript?

后端 未结 5 1009
暖寄归人
暖寄归人 2020-11-29 18:57

In all the articles it is written that JavaScript is a prototype-based language, meaning that every object has a prototype (or, more precisely, prototype chain).

So

5条回答
  •  忘掉有多难
    2020-11-29 19:04

    var F = function(){};
    var object1 = new F();
    alert(object1.constructor === F);
    alert(object1.constructor.prototype === F.prototype);
    

提交回复
热议问题