[Solved] Javascript: Check to see if multiple array values are the same (order matters)
You can use a counter to see if values of 1 are sequential. function containsSequence(arr, val, max) { var count = 0; for (var i = 0; i < arr.length; i++) { if (arr[i] === val) { counter++; // increment the counter by 1 } else { counter = 0; // reset counter } // … Read more