0
I’m having trouble with this next army:
Set the podeSubir function, receiving 3 parameters: highPessoa (number), timeCompania (boolean), temProblemaCardiaco (boolean). Take into account the necessary conditions mentioned below:
- Reach a height of at least 1,5 m (or 1,2 m if accompanied by an adult)
- Not having any heart problem.
The code went like this
function podeSubir(alturaPessoa, vemComCompania, temProblemaCardiaco) {
return (
(alturaPessoa <= 1.2 && vemComCompania) ||
(alturaPessoa >= 1.5 && !vemComCompania) && !temProblemaCardiaco
);
}
console.log(podeSubir(1.5, false, false))
console.log(podeSubir(1.7, false, true))
console.log(podeSubir(1.2, true, false))
console.log(podeSubir(1.2, false, false))
console.log(podeSubir(1.1, true, false))
But the problem is I can’t get past the last of the validations:
- a person who is 1.5m, is not accompanied by an adult and has no heart problems can rise in attraction -> correct
- a person who is 1.7m, is not accompanied by an adult and has heart problems can not rise in attraction -> correct
- a person who is 1.2m, is accompanied by an adult and has no heart problems can rise in attraction -> correct
- a person who is 1.2m, is not accompanied by an adult and has no heart problems can not rise in attraction -> correct
- a person who is 1.1m, is accompanied by an adult and has no heart problems can not rise in attraction -> is returning true and the correct is false
Thank you so much for all your attention and help
I edited my doubt better, I hope it has become more coherent and sorry for any confusion
– Raphael Barreto