Practice ยท 1 of 3
Field Validator
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.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Advanced Forms โ Practice