Javascript Prototype not Working

后端 未结 4 474
刺人心
刺人心 2021-01-06 20:59

Hi I don\'t know whether this is my mistake in understanding Javascript prototype object ..

Well to be clear I\'m new to the Javascript singleton concept and lack c

4条回答
  •  無奈伤痛
    2021-01-06 21:13

    Update: Seeing your updated code, the return from referrelSystem won't work as expected, since return values are discarded when calling new referrelSystem().

    Rather than returning an object, set those properties to this (the instance of referrelSystem that gets constructed):

    var referrelSystem = function () {
        // I assume you have other code here
    
        this.login = getSignedIn;
        this.initTwitter = initTw;
    };
    

提交回复
热议问题