我刚刚开始学习网页开发,并决定制作一个简单的apache cordova应用程序,但出于某种原因,我的for循环无法启动。
index.js:
(function () {
"use strict";
document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false );
renderList();
function renderList()
{
console.log("renderlist")
for (i = 0; i < 5; i++) {
console.log("for loop")
}
}
function onDeviceReady() {
//default apache cordova stuff
};
在javascript控制台中我只获得“renderlist”,但没有“for loop”或“end”
答案 0 :(得分:3)
你需要宣布我。
for (var i = 0; i < 5; i++)