i am trying to find a solution having the computer check players clicks and see if it matches the original random choice array that a function called computerDisplay created. Could anyone please explain how i could have the computer check the array after each increment in the color patterns example starts with red stops check if player has clicked red and moves on with red and then new color yellow. Each time building a larger pattern of colors until twenty rounds have been reached. Here is my code up to date. https://codepen.io/Ajax-2031/pen/jGKMzj?editors=1111. im keeping track of random colors selection with classVariable array and players clicks with userClick array. This is the following method at w3schools(https://www.w3schools.com/jsref/jsref_every.asp) that i tried to check if arrays do match. I could not get it to return a true value if arrays did match.
I did a bit of work cleaning up your code so its a bit easier to read. I changed names and functions as little as possible so that it essentially the same code. I annotated my changes in the code so you can understand where I changed things. Feel free to fork from this point, and erase what you have read and don’t need. https://codepen.io/moseschild/pen/zELMoj?editors=0011
If you need some ideas on how to write the playSequence function, you can check out mine :Simply Simon