[removed] add methods to function prototype

前端 未结 2 969
陌清茗
陌清茗 2021-02-13 12:17

Is there a shorter way to write this:

var controller = function(){ 
    /*--- constructor ---*/
}; 

controller.prototype.function1 = function(){ 
    //Prototy         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-13 12:39

    Object.assign(controller.prototype, { function1: ... })

提交回复
热议问题