javascript - Printing previous answers -
i creating game user has try , guess combination of code. want user able see previous attempts has had. @ moment can div box's in display recent code.
here code function is.
game.countanimals = function(playergo){ var count = {bulls:0, cows:0}; game.counter = 1; (var = 0; < playergo.length; i++) { var digpresent = playergo.indexof(game.score[i]); if (playergo[i] == game.score[i]) {count.bulls++;} else if (digpresent>=0) {count.cows++;} game.counter++ if (count.bulls == playergo.length && game.counter < 7){ console.log("you have won")} else if (count.bulls !== playergo.length && game.counter < 7) { console.log("sorry homes")} else if (count.bulls !== playergo.length && game.counter > 7 ){console.log ("you lose");} } $(".scoreboard1").html(count.cows); $(".scoreboard2").html(count.bulls);
Comments
Post a Comment