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

Using the 'inArray' method check if the array contains the string 'Andrew'

I get the error "It looks like Task 1 is no longer passing."

This is my code:

var values = $(".required").map(function(){
  return $(this).val();
  return values;
});
return $.inArray("Andrew", values);

4 Answers

Got it to pass by removing "return" from the inArray method. Go figure.

Hi Scott - glad it worked out for you ^^ in the future feel free to email us at help@teamtreehouse.com too if you're stuck! Cheers :D

Can anyone explain why all we have to do is remove the return portion? I know it didn't ask us to return the value but I'm thinking both Scott and I thought "return" was a given.

Caesar Bell
Caesar Bell
25,198 Points

From my best knowledge you are not returning anything. You are just checking for the values within the array for the string "Andrew", and thats wouldnt be the correct way to return for a value.