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

Form Validation and Manipulation - Checking Values. Can't finished Challenge 2

I can't finished my work, and I don't know what's wrong.

Challenge task 2 of 3:

Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'.

My code:

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

function requiredValues() {
  var total = new Array();
  $("input .required")each(function(){
    total.push($(this).val());
  });  
    return total;
}

And I get this answer:

Oops! It looks like Task 1 is no longer passing.

What's wrong, where is my mistake

2 Answers

Zen Hess
Zen Hess
6,700 Points

Johannes V,

Your code is very close. Look back through your punctuation. JavaScript is very finicky.

Thanks for thoroughly asking the question!

Thank's.. I find the points...