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

Brian Schmitz
Brian Schmitz
11,167 Points

Checking for Andrew in the array, can someone please help. Thanks

var $required = $(".required"); function containsBlanks () { var values = $required.map(function () { return $(this).val(); }); return $("Andrew", values) != -1; };

Brian Schmitz
Brian Schmitz
11,167 Points

And I did have $.inArray("Andrew", values), just didn't copy in above. Thanks

1 Answer

I think your problem here is putting the code inside the 'containsBlanks()` function which the challenge didn't ask for.

After the task1 code you should add in the .inArray method call. It's not really clear to me what should be the code for task 2.

I passed with this:

var values = $('.required').map(function () {
  return $(this).val();
});

$.inArray('Andrew', values);

It doesn't seem to require that you do anything with the return value of that method call.