I'm trying to make arrow function to reduce the code, but I always get an error. How should I ask about this code ? Thanks.
const torrente= 'Torrente-4, Lethal Crisis'
const pgTorrente= 13
const nameMiguel= 'Miguel'
const ageMiguel= 43
const nameGuille= 'Guille'
const ageGuille= 11
const entersTorrente =(name, age, isWithAdult)=>{
if (age >= pgTorrent){
alert(`${name} puede entrar a ver ${torrente}`)
} if else=>(sWithAdult){
alert (`${name} puede pasar a ver ${torrente}.
Aunque tiene ${age} va con un adulto.`)
}
else{
alert(`${name} no puede entrar a ver ${torrente}.
Tiene ${age} y necesita tener ${pgTorrente}`)
}
}
entersTorrente(nameMiguel, ageMiguel)
entersTorrente(nameGuille, ageGuille, true)
Fixed some syntax and variable errors.
1- Instead of if else es
else if
and remove the=>
2- In the line
else if(isWithAdult)
you had eaten the letteri
.3- And the quotes
''
too.Those are the bugs I fixed to make it work.
I don't know if it will help you, but it works at least.