Use IntersectionObserver to detect when a sentinel element at the bottom is visible. When visible, load more data and append. Show a loading indicator. Stop when there is no more data. Clean up the observer when done.
How do I build infinite scroll in a machine coding interview?
More FAQs in Advanced Machine Coding Questions for Frontend Interviews
Star rating, nested comments (Reddit-style), tic-tac-toe, stopwatch, calculator, password strength meter, drag and drop list, tooltip, breadcrumb, and infinite scroll. These test recursion, game logic, APIs, and algorithms.
Create 5 star icons. On hover, highlight up to the hovered star. On click, lock the rating. Support half-stars with a clip or two separate icons. Add keyboard support (arrow keys to change, enter to select). Reset on mouse leave if not clicked.
Use a tree data structure. Write a recursive render function. Each comment has reply, vote, and collapse handlers. Indent nested comments by depth. Handle reply (add a child), vote (update score), and collapse (toggle children).
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.