From the course: Learning Functional Programming with JavaScript ES6+

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Challenge: Error messages

Challenge: Error messages - JavaScript Tutorial

From the course: Learning Functional Programming with JavaScript ES6+

Start my 1-month free trial

Challenge: Error messages

(upbeat electronic music) - [Instructor] Now let's move on to our final challenge. This challenge is a lot more open ended than the previous two and it involves generating error messages for form values like we might see on any sign up form on a website. So up top here we have an object representing our form values. So for example we might have a first name input box, a last name input box, and ZIP code and state input boxes. And the value that we have for each of these properties is the current value that's in the corresponding text box. We then have a separate criteria object that contains the checks we want to perform on each of our input boxes. Now I mentioned that this challenge is pretty open ended, so I haven't filled any of these in yet. But the requirements for each of these fields is up at the top. So for example, the first name and last name have to be at least two characters long. The ZIP code has to be exactly five characters long and the state has to be exactly two…

Contents