MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / checkAnswer

Function checkAnswer

assets/js/Sequence-game.js:66–86  ·  view source on GitHub ↗
(currentLevel)

Source from the content-addressed store, hash-verified

64}
65
66function checkAnswer(currentLevel) {
67
68 if (gamePattern[currentLevel] === userClickedPattern[currentLevel]) {
69
70 if (userClickedPattern.length === gamePattern.length){
71 setTimeout(function () {
72 nextSequence();
73 }, 1000);
74 }
75 } else {
76 playSound("wrong");
77 body.classList.add("game-over");
78 setTimeout(function () {
79 body.classList.remove("game-over");
80 }, 200);
81
82 leveltitle.innerText="Game Over, Press Any Key to Restart";
83 startOver();
84 }
85
86}
87
88function startOver() {
89 level = 0;

Callers 1

clickedFunction · 0.85

Calls 3

nextSequenceFunction · 0.85
startOverFunction · 0.85
playSoundFunction · 0.70

Tested by

no test coverage detected