lundi 3 mai 2021

Else if not returning the right value, always random

I modified a github code by adding additional genders. This function should return an image with the right gender. I have added two genders but the code always gives me a random gender. I already checked the board but didn't find anything simmilar.

  var integer = getRandomInt(1000)

  if (integer >= 500) {
    return "Female";
  } else if (integer == 1) {
    return "Zombie";
  } else if (integer == 2) {
    return "Alien";
  } else {
    return "Male";
  }
}



Aucun commentaire:

Enregistrer un commentaire