const arr = [1, 5, 99, 1, 1, 1, 2, 8, 1, 1 ,1 ,1]
Math.max(0, ...arr.reduce((acc, n, i, a) => (
n !== a[i - 1] && acc.push(0),
acc[acc.length - 1]++,
acc
), []))
arr.reduce((acc, n, i, a) => (
n !== a[~-i] && (acc[1] = 0),
acc[0] = acc[+(++acc[1] > acc[0])],
acc
), [ 0, 0 ])[0]