有个函数:
function uploadHandler(type, crop, callback){
....
}
其中type为必传参数,而crop:为true或false和callback可有可无。
但我又想给crop定义一个默认值,比如false
if(crop === undefined){
crop === false;
}
然后我这样调用
uploadHandler("img",function(){
})
此时function会被当第二个参数覆盖了crop,请问如何处理?