zoukankan      html  css  js  c++  java
  • 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>
    
    
  • 相关阅读:
    GO make&new区别
    GO 包相关
    GO 类型断言
    栈 队列 链表
    表达式求值
    动态规划 最长子序列
    04 单例模式
    02 简单工厂模式
    java设计模式 01 开山篇
    java基础07 多线程
  • 原文地址:https://www.cnblogs.com/jianjie/p/12242411.html
Copyright © 2011-2022 走看看