1.在函数中,不使用var声明的变量都会变为全局变量

function fun(){
  d=10;  //window.d=10;
};
console.log(10);//10

2.定义形参就相当于在函数作用域中声明了变量

function fun(d){
  console.log(d);//undefined
};
fun()

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-12
  • 2021-08-19
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-03-31
相关资源
相似解决方案