Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build an Interactive Website Form Validation and Manipulation Checking Values

Jahan Zeb
Jahan Zeb
11,169 Points

Stuck at code challenge 3rd task

Hi experts, I am stuck at 3rd task of the code challenge. Could anyone please help me out?


The first two tasks are passing fine:

function isValidEmail (email) {
    return email.indexOf("@") !== -1;

function requiredValues () {
  var myArray = new Array;

  $(".required").each(function () {
  return myArray;

Now this one wont and in fact it sends me back to 1st task:

function containsBlanks () {
  var blanks = new Array;
  $(".required").each(function () {
    blanks.push($(this).val() == "");
    return blanks.sort().pop();
  //or return blanks.indexOf(true) !== -1;

2 Answers

Hi Jahan,

The logic looks fine. You didn't properly close off the .each method. You were missing the closing ) and ;

Jahan Zeb
Jahan Zeb
11,169 Points

Thanks a lot Jason for pointing out the syntax error. I think I need to stop working too late in the night.

You're welcome.