Facebook Pixel

How do I build infinite scroll in a machine coding interview?

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.

Verify This Answer

Cross-check this information using these trusted sources:

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?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.