# Array `slice` and Indexing Your snippet uses `slice` and index-based access to create weekly intervals. ## `slice(0, -1)` ```ts const periodStarts = alignedStarts.slice(0, -1); ``` - Start at index `0`. - Stop before the last item (`-1` means from the end). - Useful when each `start` needs a following `end` item. ## Index access ```ts const end = alignedStarts[index + 1]; ``` - Gets the next boundary after the current `start`. ## Python comparison ```py period_starts = aligned_starts[:-1] end = aligned_starts[index + 1] ``` This is the same concept as Python slicing and list indexing.