1、乘积函数
代码
function mul(){
let {slice}=Array.prototype;
let argus=slice.call(arguments,0);
let returnFn=function(){
let arguArr=slice.call(arguments,0);
return mul.apply(null,arguArr.concat(argus))
}
returnFn.valueOf=function(){
return argus.reduce(function(total,item){
return total*item
})
}
returnFn.toString=null
return returnFn
}
alert(mul(3)(3,3)(4))
alert(mul(3,10,3))
2、一个表达式的结果
const result=++[[]][+[]]+[+[]];
console.log(result)//?
答案:‘10’
+[ ] => 0
[+[ ]] => [0]
[[]][0] => []
++[] => 1
1+[0] => ‘10’