如何解释下面的两端代码运行结果1a中回调b,b打印x。b为什么拿不到a中的x;leta=fn=>{constx=1;fn();};letb=()=>{console.log(x)};a(b);//UncaughtReferenceError:xisnotdefined2leta=fn=>{x=1;fn();};letb=()=>{console.log(x)};x;//UncaughtReferenceError:xisnotdefineda(b);//1
守着星空守着你
Smart猫小萌
汪汪一只猫
随时随地看视频慕课网APP
相关分类