Let me start directly with the question. Imagine there is a star icon on the screen. When you hover on it, the background color becomes yellow.
Now comes the tricky part. When you click the star, it becomes selected. Even if you remove your mouse cursor, the star should remain highlighted. After clicking, if you hover again and then move the mouse away, it should stay in the clicked state, not reset.
Most engineers fail here because they mix hover state and click state logic. This question checks whether you understand state management, event handling, and UI behavior, not just CSS or JavaScript syntax.
This looks simple, but it’s one of the most common interview traps — and that’s exactly why interviewers love it.
🎥 Prefer video learning? Click here to watch the full explanation on Instagram.
If you want to learn more interview-ready web development like this, click the WhatsApp icon on your screen and contact me directly. I teach how real interviews actually work — not just theory.
