js 基础(一)
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);