samedi 8 février 2020

Invoking an if-statement to have 2 conditions. A if and a else in JavaScript [closed]

Learning JavaScript and Im stuck on this question for 2 days now, please help!

Define a function teenager that accepts an age as a parameter. If the age is between 13 and 19 it should return "You are a teenager!". Otherwise should function should return "You are not a teenager". My code:

function basicTeenager(age) {
    if(age >= 13 && age <= 19)
    return 'You are a teenager!'
  }
     else() {
     return 'You are not a teenager'
} 

Where did I go wrong?

Aucun commentaire:

Enregistrer un commentaire