0
我試圖獲取JavaScript setTimeout函數與回調的工作,但得到「失蹤形式參數」從FUNC功能錯誤...的setTimeout - 跟進問題
var pCodes = [ 'a','b','c' ];
$.each(pCodes, function(index, pCode) {
setTimeout(function() {
func(pCode, callback);
}, 2000);
});
function func(in, callback){
callback(in);
}
function callback(value) {
alert(value);
}
確實... https://developer.mozilla.org/zh/JavaScript/Reference/reserved_words – bob