Grokking the Modern Frontend System Design Interview
0% completed
Exercise: Rows to Render in a Virtual List
Virtualizing Long Lists kept only 22 of Basket's 4,000 rows in the DOM. The renderWindow function in that lesson finds the first row from the scroll position, subtracts the overscan, and then draws the rows that fit in the viewport plus the overscan on both sides. This exercise computes which rows that function draws.
The Task
Write visibleRange(scrollTop, viewportHeight, rowHeight, overscan, totalRows), which returns [first, last], the indices of the first and last rows to render
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%