Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, December 3, 2012

Codecademy: Codeyear Using if else statements in functions


//sample solution

var checkNameGender = function (yourName,gender) {
//All the code below was used in exercise 1.6
 
    if (gender.length > 0 && yourName.length > 0) {
      if (gender === 'male' || gender === 'female') {
            return true;
      } else {
            return false;
      }
    } else {
      return false;
    }
};
checkNameGender("Pam","female");

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts