Javascript Prototype not Working

后端 未结 4 486
刺人心
刺人心 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条回答
  •  猫巷女王i
    2021-01-06 21:34

    I don't think you intend to immediately execute the functions, change them to this:

    var referrelSystem = function(){
    //Some code here
    };
    

    (+var, -())

    Same with the prototype function:

    referrelSystem.prototype.postToFb = function(){
    //Some Code here
    };
    

    (Here you don't need the var, because you're assigning to something that already exists.)

提交回复
热议问题