Skip to content

Instantly share code, notes, and snippets.

@nickstewart95
Created December 19, 2016 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickstewart95/3daa15a00a4c56677d9a529eb836a68c to your computer and use it in GitHub Desktop.
Save nickstewart95/3daa15a00a4c56677d9a529eb836a68c to your computer and use it in GitHub Desktop.
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