Created
December 19, 2016 16:49
-
-
Save nickstewart95/3daa15a00a4c56677d9a529eb836a68c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkAcross(arr, val, limit) { | |
var counter = 0; | |
for (var i = 0, l = arr.length; i < l; i++) { | |
counter = (arr[i] === val) ? ++counter : 0; | |
if (counter === limit) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment