Skip to content

Instantly share code, notes, and snippets.

@uzorjchibuzor
Last active June 4, 2018 21:54
Show Gist options
  • Save uzorjchibuzor/e6c7204ae35dc7dc2e68f6d78183e7b4 to your computer and use it in GitHub Desktop.
Save uzorjchibuzor/e6c7204ae35dc7dc2e68f6d78183e7b4 to your computer and use it in GitHub Desktop.
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;
}
@Oluwasetemi
Copy link

for of loop is only good on objects!! for your request on material to study for objects, check JavaScript Info on Objects

@Oluwasetemi
Copy link

fcc5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment