构造函数的返回值

/**
         关于构造函数的返回值; 
         原本以为无论设置返回的东西只返回this, 也就是这个构造对象;
         return []; 返回此数组
         return {}; 返回此对象
         return function; 返回此函数
         return 1; 返回this;
         return 'a'; 返回this;
        return null; 返回this;
        return undefined; 返回this;
        return this.functionName; 返回此函数;
        return this.objectName; 返回此对象;
        return this.arrayName; 返回此数组
        return this.stringName; 返回this;
        return this.numberName; 返回this;
        return this.nullName; 返回this;
        return this.undefinedName; 返回this;

     */
     
    var lang = function(arg){
        return undefined;
    }
    lang.prototype = {
        objectName: {},
        functionName: function(){},
        arrayName: [1,2,3,4],
        stringName: 'aaa',
        numberName: 1234,
        nullName: null,
        undefinedName: undefined

    }
原文地址:https://www.cnblogs.com/somesayss/p/3084127.html