jeudi 27 octobre 2016

How do I pass arguments in function?

Trying to complete an if/else Codecademy exercise (question #14) but it doesn't say how to pass action values into the function so I'm winging it, unsuccessfully. Below is my attempt by assigning values to the variables (lines 1 & 2) but getting "false" try again response.`

BTW..not getting much help via Q&A forum in Codecademy.:(

var yourName = "Tammy"; //I added this 
var gender = "female"; // I added this

// this line and below are static, provided by Codecademy

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;
    }
};

Aucun commentaire:

Enregistrer un commentaire