0
我想通過一個整數值我回調,這是不按預期工作,因爲我可用作爲參考。如何將值傳遞給JavaScript回調/ clousure作爲傳值
for (var i = this.texturesPath.length - 1; i >= 0; i--) {
var textureIndex = i;
loader.load(baseTexturePath + this.texturesPath[i], function(texture) {
scope.textures[textureIndex] = texture;
});
這種情況下的解決方案/方法是什麼?
@ user3804449爲什麼你投我的答案,我相信是一個正確的答案 – AngelSalazar