let  p1 = {
  name: 'shangyy',
  age: 18,
}

function func(person) {
  person.age = 25;
  person= {
    name: 'huyating',
    age: 20,
  };
  return person;
}

const p2 = func(p1);
console.log(p1); // { name: 'shangyy', age: 25 }
console.log(p2); // { name: 'huyating', age: 20 }

 

function test(a){
  var a;
  console.log(a);
  function a(){
    console.log('a')
  }

}

test(1); // [Function: a]

 * 不会申明提前

* 暂时性死区

* 不会=挂载待window 上

var a = 123;
function test () {
  console.log(a); //a is not defined
  let a=1;
  
}

test (1);

 

相关文章:

  • 2022-01-25
  • 2021-11-06
  • 2021-07-07
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-06-11
猜你喜欢
  • 2021-04-26
  • 2021-08-03
  • 2021-06-12
  • 2021-06-22
  • 2021-12-09
  • 2022-12-23
  • 2021-11-11
相关资源
相似解决方案