Skip to main content

Practice · 1 of 3

Field Validator

CHALLENGE
Difficulty: intermediate+25 XP

Write validateField(name, value) that RETURNS null when valid or an error-message string when not: - name — required, 2–40 characters after trim - email — must contain @ with non-empty parts on both sides - age — a number 16–120 inclusive (accept numeric strings) Any other field name returns null.

Back to lesson: Practice: Advanced Forms — Practice