Is there any maximum limit of conditions for If
in Javascript? I am using following method to detect bombs in division "b". But it skips more than 3 or 4 conditions and hence less bombcount than the actual count.
The following function triggers as soon as I click on div b
where b = some number
. It has a Kwhere I check for bomb in every cell and if the cell with the bomb satisfies the position criterion it increases bombcount by 1.
var i = 1;
var p1 = b-1;
var p2 = b+1;
var p3 = b+6;
var p4 = b-6;
var p5 = b-5;
var p6 = b+5;
var p7 = b-7;
var p8 = b+7;
var bombcount = 0;
while(i<37)
{
var check = document.getElementById(i).value;
if (check == "explode" && b>6 && b<31) {
if(i==p1 || i==p2 || i==p3 || i==p4 ||
i==p5 || i==p6 || i==p7 || i==p8) {
bombcount++
};
}
i++;
}