Skip to content

Instantly share code, notes, and snippets.

@ethanstenis
Created July 13, 2017 21:46
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 ethanstenis/a104278f6c64ab9017d04e99ef4ce9b5 to your computer and use it in GitHub Desktop.
Save ethanstenis/a104278f6c64ab9017d04e99ef4ce9b5 to your computer and use it in GitHub Desktop.
This is the solution for Codewars' KATA: Find the First Non-Consecutive Numbers
function firstNonConsecutive (arr) {
for(let i = 0; i < arr.length-1; i++) {
if(arr[i] + 1 !== arr[i + 1]) {
return arr[i + 1];
}
}
return null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment