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

<!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>

posted on 2020-01-30 11:55  冲啊!  阅读(401)  评论(0编辑  收藏  举报

导航