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

All tasks on 'Checking Values'

Edit: Forum post methods need sorting out. It's gone and put the function I posted below on the same line with the comment, please ignore that. I'm not that much of a 'tard.

Don't know what I'm doing wrong here. Someone please take a look before this headache kills me. Thanks.

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

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

}; //=================================== function containsBlanks(){ var blanks = new Array(); var $required = $(".required")

$required.each(function(){ blanks.push($(this).val() == ""); });

Thanks again.

4 Answers

Hi osas idemudia, I understand your concern and I can relate to your issues. I do agree with you and I actually have similar difficulties in understanding javascript/jquery courses. Particularly the jquery stages , I really do feel it was rush and I'm having hard time understanding the fundamentals of jquery which led me to spending few days on the code challenges hell hole. It is longest day of my life. if i have to say...

Perhaps after you've taken some time off and then come back, take a detailed look on your code. You'll find the missing signs. You're very close to the answer. :)

Good luck Osas! Keep up the good work!!

tried improving it and still struck:

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

function requiredValues (){
    var $required = $(".required")
  var blanks = new Array();

  $required.each(function (){
    blanks.push($(this).val());
  });
  return blanks;
};

function containsBlanks(){
  var blanks new Array();
  $("required").each(function(){
    blanks.push($(this).val() == "");
  });  
  return blanks.indexOf(true) != -1;
};

Hi osas idemudia , I'm not sure i can be helpful as you're almost there. Probably you've figured it out since you've posted it 14 days ago.

Looking at your code. I see you've missed the "equal" sign while you're declaring an new array and the ". " sign while you're trying to select the appropriate element on your function.

Thanks for the reply Febby, I kind of gave up on the whole jquery stage as I didn't feel it was properly taught. I've done a few courses (currently on php) and I have to say the jquery lessons are the most difficult to understand till date. I feel many things were rushed (even though I already did the javascript foundation).

I was already getting frustrated at that stage so when I couldn't get past that, even for something as basic as a syntax error, it was like the last straw really. Currently starting afresh at codecademy. Maybe when I'm done there and I have a better grasp, I'll come back to it.

Thanks again.