码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-01-30 12:35:28      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:lang   width   efi   ons   ini   lookup   type   ===   构造   

<!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__属性

标签:lang   width   efi   ons   ini   lookup   type   ===   构造   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!