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!
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
Danny Wheeler
3,966 PointsBuild an Interactive Website - Code Challenge: Checking Values
I have completed step 1 and 2 and been given the green light for each. Now When i input my code for step 3, it tells me that my code for step 1 is no longer valid. If a remove my code from step 3, step 1 becomes valid again. I can't see how the containsBlanks() function is affecting the isValidEmail() function?
function isValidEmail(email){ return email.indexOf('@') != -1; }
function requiredValues(){
var requiredInputs = new Array();
$('.required').each(function(){
requiredInputs.push($(this).val());
})
return requiredInputs;
}
function containsBlanks(){
var blanks = new Array();
$('.required').each(function(){
blanks.push($(this).val() == "");
}
return blanks.sort().pop();
}
2 Answers

Kevin Korte
28,147 PointsIt appears that in the function containsBlanks, you have a semantics error. Double check all of your curly brackets, parenthesis, and colon usages to make sure everything that was opened, was closed properly. I think you'll find you left one open.

Danny Wheeler
3,966 PointsAha thanks Kevin.
Funny how every time i rewrote that function i missed the same parenthesis!

Kevin Korte
28,147 PointsYou're welcome. Glad you found it!
Michael Swanson
2,411 PointsMichael Swanson
2,411 PointsI have tried putting your first answer(function isValidEmail(email){ return email.indexOf('@') != -1; }) in as the answer to the first question, but It is not working for me. I have literally copied and pasted it from not only the video previous to the challenge, but from what you have written here as well, which seems to be the same.
What am I doing wrong?