Dolf,
пробуйте
$(function() {
let index = 1,
max = 4,
length = 5;
const hideCells = _ => document.querySelectorAll("#ex3 tr")
.forEach(({ cells }) => {
[...cells].forEach(({ style }, i) => i && (style.display = i < index || i >= index + max ? "none" : "") )
})
hideCells();
$(".scroll-table").on("click", "[data-up]", function() {
index += +this.dataset.up;
index = Math.max(1, Math.min(length - max, index));
hideCells()
})
});