In this memory game, event listeners respond to user input after a sequence of colored divs change color to appear illuminated. The expected behavior is that once the user clicks on the correct div in the right order, the sequence restarts with an additional illuminated div until reaching the last number in the array. At that point, a function informs you if you win or lose. However, there seems to be a random issue occurring when around 4 to 6 divs are illuminated, where even if you choose the correct set of divs, the losing function is triggered. When restarting the game (without refreshing the page), the code immediately triggers the losing function from the first try. The function responsible for checking and comparing user input is called 'chooseColor(ev)', and the variables tracking the levels (level and sublevel) reset every time you win or lose.
> <script>
// JavaScript code goes here
</script>
> <style>
/* CSS styles go here */
</style>
</head>
<body>
<div class="gameboard">
<!-- HTML content for the game board -->
</div>
<audio src="./notas/nota1.mp3" id="audio1" preload="metadata"></audio>
<audio src="./notas/nota2.mp3" id="audio2" preload="metadata"></audio>
</body>
</html>