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

Challenge Problem

I'm stuck at the challenge 2. Is there anyone who knows the solution and could provide me with the code.

Thanks! http://teamtreehouse.com/library/build-an-interactive-website/form-validation-and-manipulation/checking-values

3 Answers

I got it to work -- turns out I was misreading the question. Instead of the answer, I'll give you pseudo-code to recreate it. :) Don't want to take away all the fun for you. :)

  • open function requiredValues that accepts no arguments
  • declare an empty array that will hold the values
  • declare an array to hold the input fields, and instantiate it using a jQuery selector to get all input fields with a class of required and convert it to an array.
  • open a for loop to loop through the array of input fields
  • assign the value of each input field to the corresponding index in the empty array
  • close the for loop
  • return the array holding the values
  • close the function

Best of luck, and Merry Christmas! ~Mike

That's what I call a great example of giving help, not answers!

Thanks, James! :) Merry Christmas!

thanks

Thanks Mike, I'll take a look into challenge a bit later. You're right, it's better to have an answer like this and learn how to do it.

Merry Christmas!!