Query an array at intervals and getting the highest number of values
Instead of writing two cases depending on the length of the chunk, you could certainly make one general way for each task. Doing so you simplify the code inside maxAtIntervals and get rid of findmax (as you can use .sort().slice(-n) to get the max n numbers).

The return of maxAtIntervals is [values]. If values is already an array, why would you create an array of 1 array?

There are so many comments I could not even focus on the code. Be succinct!

After applying this changes and removing unnecessary variables, the function looks like this:

function maxAtIntervals (intervalLength, grab, xs) {
    const comparator = (a, b, _) =&gt; a - b;
    const temp = [];

    for (var i = 0; i &lt; xs.length; i += intervalLength) {
        const interval = xs.slice(i, i + intervalLength);
        temp.push(interval.sort(comparator).slice(-grab));
    }

    return temp;
}


Your original code makes 111ms on my machine. After my changes it goes to 51ms.