Hello I am having trouble with the check player against simon portion of my code. The code runs well until that player/checking part.Any suggestions /help with what I did wrong (I think the storing of id’s into my array is the problem ). Any suggestion I will be very thankful for
function clean(){
player=0;
store();
}
function store (){
if (player.length>=simon.length){
fight ();
}
}
function fight( ){
if(player.concat (simon)!==simon.concat (player) && $( ":checkbox" ).is( ":checked" ) ){
alert ("GAME OVER! press restart");
}
else if(player.concat (simon)!==simon.concat (player) {
alert("Try Again! Pick your self up from your bootstraps and try it again slugger!");
rabbit ();
}
else if( player.concat (simon)===simon.concat (player) && round===20){
$("h1").html ("WAY TO GO, SMARTY PANTS");
alert("YAY! YOU WIN! press restart");
}
else {
begin();
}
}
I already have functions that pushes the player’s array in the happily running portion of my code like so :
function shoulders (){
$("#shoulders").css ("background-color","cyan");
track3.play();
setTimeout(function() {
$("#shoulders").css("background-color","");
}, 300);
}
$("#shoulders").click (function (){
player.push ("#shoulders");
shoulders();
})