Codewars "Consecutive strings" kata
Some performance-related nitpicking:


Instead of string concatenation keep an array of string lengths;
Use a running window of current concatenated length: when advancing to the next string simply subtract the first window's element and add the current string length.


Thus the array will be iterated just once, no extra strings interned in the JS engine.

const longestConsec = (strings, count) =&gt; {
    let n = strings.length;
    if (!n || count &lt;= 0 || count &gt; strings.length)
        return '';

    let lengths = Array(n);

    // fill the running window
    let windowLen = 0;
    for (let i = 0; i &lt; count - 1; i++) {
        let stringLen = strings[i].length;
        windowLen += stringLen;
        // fill the cache with items 0..count-1, the rest will be filled in the main loop
        lengths[i] = stringLen;
    }

    let maxLen = 0;
    let maxLenAt = 0;
    for (let i = count - 1, windowStart = 0; i &lt; n; i++, windowStart++) {
        let stringLen = strings[i].length;
        lengths[i] = stringLen;

        let thisLen = windowLen + stringLen;
        if (thisLen &gt; maxLen) {
            maxLen = thisLen;
            maxLenAt = windowStart;
        }
        windowLen += stringLen - lengths[windowStart];
    }

    return strings.slice(maxLenAt, maxLenAt + count).join('');
}