Javascript:如何在暂停时循环遍历数组?

时间:2019-02-05 20:10:45

标签: javascript loops for-loop login

var clientBASE = new User();
var username = ["Username1","Username2"];
var password1 = ["Password1","Password2"];
var arrayLength = username.length;
var i;

for(i=0; i < arrayLength; i++){
    client.logOn({
        "accountName": username[i],
        "password": password1[i],
    });
{

clientBASE.on('loggedOn', function(details) {
    console.log("Logged into Server as " + clientBASE.userID.getUserID());
    clientBASE.setText("Logged in");
    console.log("Logged In");
    clientBASE.logOff();

});

}

目前,脚本当前仅登录到Username2并跳过username1 该脚本应登录到username1,运行代码,暂停,然后登录到username2并运行相同的代码。

任何帮助将不胜感激

0 个答案:

没有答案