samedi 3 juin 2017

what is the use of if else statements?

I don't quite understand the meaning of else if statements.

why not just to continue with the if statements in case one is false?

it works the same.

example with if only that will work the same with else if:

function testSize(num) {

  if (num < 5){

     return "Tiny";
  }

  if (num < 10){

    return "small";
  }


  return "Change Me";

}


testSize(7);

Aucun commentaire:

Enregistrer un commentaire