samedi 22 décembre 2018

This is the beginning question on Else/If function

var respond = ["hello", "nothing"];
function speak() {

    if ("hey") {
        return "hello";
    }
    else if ("whats up") {
    return "nothing";
    }

}
  var check = speak("whats up");

It worked when I typed speak("hey") it returned "hello" but speak ("whats up") not did not return "nothing". Where did I go wrong?

Aucun commentaire:

Enregistrer un commentaire