比如想写一个回调,可以用promise:
function a(){ return new Promise(function(res,rej){
res()
})
}
a().then()但是现在希望代码能直接在浏览器运行,而不是经过webpack(ES6转5).
那么用
var a = function(x){x();}
a(function(){ console.log('回调')
})//↑像这样的写法会不会存在什么问题?比如兼容等等
翻过高山走不出你
慕慕森
互换的青春
随时随地看视频慕课网APP
相关分类