箭头函数作用域是全局
const arrow = function(pass){}//普通函数
const arrow1= (pass)=>{} // 箭头函数,一个参数可以省略括号,两个不能省略
const lucl={
id:2,
setWithArrow:function(){
console.log(this.id)
},
setrbool:()=>{
console.log('23'+lucl.id) //这方法已经是全局作用域了
}
}
lucl.setWithArrow()//2
lucl.setrbool() //23
// 因为这个已经是全局作用域里面了 所以unfinder 除非再这个箭头前面再加个function(){}
// const lucl={
// id=2,
// setWithArrow:function(){
// console.log('这里取不到数值'+this.id)
// },
// setrbool:bo=>{
// console.log('这里取数值2'+this.id)
// }
// }