首页 > 其他 > 详细

274 构造函数有__proto__属性,实例对象没有prototype 属性,原型对象有__proto__属性

时间:2020-01-30 12:51:13      阅读:74      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>5、构造函数有__proto__属性,实例对象没有prototype 属性,原型对象有__proto__属性</title>
</head>

<body>

</body>

</html>
<script>
    function fn() {

    }
    console.log(fn.prototype); // {constructor: ?}
    // {constructor: ?, __defineGetter__: ?, __defineSetter__: ?, hasOwnProperty: ?, __lookupGetter__: ?,?…}
    console.log(fn.prototype.__proto__); // 
    console.log(fn.__proto__); // ? () { [native code] }


    f1 = new fn()
    console.log(f1.__proto__ === fn.prototype); // true
    console.log(f1.prototype); // undefined
</script>

274 构造函数有__proto__属性,实例对象没有prototype 属性,原型对象有__proto__属性

原文:https://www.cnblogs.com/jianjie/p/12242411.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!