今天面试的时候一道面试题,大概是这样的,感觉自己很绕,希望大家帮我看下。谢谢。问题是下面会输出3次1吗,如果不会,能修改使其实现吗?functionnewFun(a){returnfunction(a){console.log(a)}}functionfun(a){console.log(a)newFun((a)=>{console.log(a)})}fun(1)
functionnewFun(a){returnfunction(a){console.log(a)}}functionfun(a){console.log(a)newFun((a)=>{console.log(a)})}fun(1)
returnfunction(a){console.log(a)}}functionfun(a){console.log(a)newFun((a)=>{console.log(a)})}fun(1)
console.log(a)}}functionfun(a){console.log(a)newFun((a)=>{console.log(a)})}fun(1)
}}functionfun(a){console.log(a)newFun((a)=>{console.log(a)})}fun(1)
}functionfun(a){console.log(a)newFun((a)=>{console.log(a)})}fun(1)
functionfun(a){console.log(a)newFun((a)=>{console.log(a)})}fun(1)
console.log(a)newFun((a)=>{console.log(a)})}fun(1)
newFun((a)=>{console.log(a)})}fun(1)
console.log(a)})}fun(1)
})}fun(1)
}fun(1)
fun(1)
胡子哥哥
相关分类