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 trialBrian Schmitz
11,167 PointsFinding the values of the array in the class of required.
Can someone please help correct this code to pass the challenge. Need to add the array to the values of the class required.
function isValidEmail (email) {
return email.indexOf ("@") != -1;
};
var $required = $(".required");
function requiredValues () {
var blanks = new Array();
$required.each (function () {
}
return blanks.push($(this).val());
}
Jason Anello
Courses Plus Student 94,610 PointsI hadn't seen your comment yet when I posted.
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Brian,
You don't have anything inside the curly braces for the anonymous function passed into the .each
method. Your blanks.push
statement should go in there and then when that's done looping you can return the blanks array at the end of the requiredValues
function.
var $required = $(".required");
function requiredValues () {
var blanks = new Array();
$required.each (function () {
blanks.push($(this).val());
});
return blanks;
}
Brian Schmitz
11,167 PointsNo problem, thanks for helping anyway. Do you have an idea on the other post I put up with finding "Andrew" in the array. Can't figure out where I'm wrong there
Jason Anello
Courses Plus Student 94,610 PointsCan you add the link in your other post?
Brian Schmitz
11,167 PointsI added the link to the challenge. Let me know if you were looking for something else. I passed the first challenge but hit a snag on the second. I know its something pretty simple I'm missing.
Brian Schmitz
11,167 PointsBrian Schmitz
11,167 PointsNever mind, figured this one out. Thanks