All jobs / Frontend / web developer
Frontend / web developer interview question · 1–3 years
The register API can fail because the email is taken or because the password is too short.
What should the UI switch on?
The strongest answer
A stable machine code (`email_taken`) plus an optional message — not a translated sentence and not the HTTP status alone
Why it works
Exactly. Status is the class; the code is the case. Strings change with locale and copy tweaks.
What a good answer covers
- Machine code + HTTP class + safe message.
- UI switches on the code.
- Copywriters may change the sentence tomorrow.
- Do not parse exceptions or English.
Answers that fall short
- Close, but not the strongest: The English `message` string; we can match with `includes`
`includes('taken')` will break the first time someone writes 'already in use'. - Weak: Only the HTTP status; 400 is enough
A 400 is 'the user can fix this', not 'which field'. - Red flag: The stack trace class name so we know which exception it was
Class names are internals. They are not a public contract.
Who gets asked this
More Frontend / web developer questions
- The app feels sluggish when typing in one field. How do you find the cause?
- Where should state live, as a rule?
- Why do teams use a server-state library instead of useEffect plus useState for data?
- Choosing between client rendering, server rendering, static generation and streaming for a new product — how…
- A 400-component app has become impossible to change safely. What structural move do you make first?
- Different screens show different values for the same entity. What is the root cause and the design fix?
- Performance regresses every quarter despite fixes. How do you make it stick?
- A trader UI keeps the whole order book in a WebSocket reducer. A blip shows an empty book. What is the socket…