Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
LongRepeat - Single Line, Spread Op, NULL catch shortcut, Array.Map, Math.Max solution in Clear category for [old] Long Repeat by Taylor_Page
"use strict";
function longRepeat(line) {
// null is falsy so OR operator works here
// nullishCoalescingOperator (??) could also be used
return Math.max(...(line.match(/(.)\1*/ig) || [""]).map(el => el.length))
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(longRepeat('sdsffffse'), 4, "First")
assert.equal(longRepeat('ddvvrwwwrggg'), 3, "Second")
console.log('"Run" is good. How is "Check"?');
}
Feb. 1, 2020