函数传参修改和奇怪的赋值OvO
let num = 10;
let setNum = num => {
console.log(num);//undefined
num = 1;//相当于undefined=1, undefined=1并不会报错!!!
console.log(num);//1
};
setNum();
console.log(num);//10
奇怪的赋值OvO
console.log({}=1)//1
console.log(undefined=1);//1
console.log(Boolean=1);//1 Boolean is not a function
console.log([]=1)//undefined is not a function
console.log(null=1)// Uncaught SyntaxError: Invalid left-hand side in assignment
console.log(""=1)// Uncaught SyntaxError: Invalid left-hand side in assignment
console.log(true=1);// Uncaught SyntaxError: Invalid left-hand side in assignment
console.log(true=1);// Uncaught SyntaxError: Invalid left-hand side in assignment