Code Room
Code reviewMedium
Question
Review this JavaScript input-validation helper (Node.js).
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
// validate an email-like string from an unauthenticated signup formfunction isValidEmail(input) { const re = /^([a-zA-Z0-9]+)+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; return re.test(input);} app.post('/signup', (req, res) => { if (!isValidEmail(req.body.email)) { return res.status(400).send('invalid email'); } createAccount(req.body.email);});Run or narrate your approach, then ask the coach.