if 优化

houseObj.listen = function(key,fn){

  // if(!this.listen[key]){

  //   this.listen[key] = [];

  // }else{

  //   this.listen.push(fn);

  // }

  (this.listen[key] || (this.listen[key] = [])).push(fun)

}

 

posted @ 2022-06-20 16:46  前端搬运工bug  阅读(22)  评论(0编辑  收藏  举报