Last active
June 4, 2018 21:54
-
-
Save uzorjchibuzor/e6c7204ae35dc7dc2e68f6d78183e7b4 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 highestStreakInAnArray(result) { | |
let highStreak = 1, | |
currStreak = 1; | |
} | |
for (let i = 0; i < result.length; i++) { | |
if (result[i] === result[i + 1]) { | |
currStreak++; | |
if (currStreak > highStreak) { | |
highStreak = currStreak; | |
} | |
} else { | |
currStreak = 1; | |
} | |
} | |
return highStreak; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for of loop is only good on objects!! for your request on material to study for objects, check JavaScript Info on Objects