Delarn
Delarn

Reputation: 59

Validation is not used while my conditions are met.

Here is my code:

function getTable(strExp){
this.strExp = strExp;
console.log(strExp);
var strTBL = "";
if (strExp === "Res"){
    for (var it = 0; it > 3; it++){
    strTBL = strTBL + jsonData.Table.ResTBL[it];
    console.log("Im in");
    }
}
else if (valeur === "Dice"){
}
return strTBL;
}

In my script I do this call : document.getElementById("ResTBL").innerHTML = getTable("Res")

When I see my console log I don't see the I'm in log, but it gives me the value of strExp.

Upvotes: 0

Views: 41

Answers (1)

Just_Mad
Just_Mad

Reputation: 4077

Just place it < 3 in a cycle

for (var it = 0; it < 3; it++) {
    strTBL = strTBL + jsonData.Table.ResTBL[it];
    console.log("Im in");
}

Upvotes: 4

Related Questions