I am trying to make a simple game, in the below function handCricketBat(), the if conditional statement is getting skipped even when the condition batsMan = bowlerMan is satisfied. It always moves on to the else statement. Can someone tell me why this is happening.
function handCricketBat(){
var total = 0;
for (x = 1; x <=6; x++){
var batsMan = prompt("Ball " + x + " \nEnter Between 1-6");
var bowlerMan = randomBall();
console.log("The bowler - "+ bowlerMan);
if (batsMan === bowlerMan) {
console.log("Howzattt");
break;
}
else if (batsMan !== bowlerMan) {
console.log("That's good batiing, scoring a " + batsMan);
continue;
}
total += +batsMan;
}
console.log(total);
}
function randomBall(){
return Math.floor(Math.random()*7);
}