在写JS的时候,可以考虑使用对象来放置命名的变量,以及常用的方法。

简单示例:

var func = {
  name:'张三',
  showName:function(name){
    console.log(name)
    console.log(this.name)
  }
};

console.log(func.name)
func.showName('李白')

 

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
猜你喜欢
  • 2021-06-22
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案