-2
if (user[1] >= 18 && user[2] >= 170) {
This line of code below I was doubtful someone explains to me please, for me it does not make much sense to take user 1 and user 2 to check if it is true or false, I may be mistaken but it would not have to be used a user for all ?
In a gym there is a register of several users containing the following information: name, age and height. And to perform a particular training, there are some requirements: To be 18 years old or older and to have a height equal to or greater than 1.70.
Create a function called highAlt that returns true (true) if it meets the requirements, and false (false) otherwise. In this function you will receive a parameter that will be an array, containing in the first position the name, second position the age of the student and in the third containing the height in Centimeters.
Example
maiorAlto(["Amazing student", 18, 170]) // returns true maiortAlto(["Low student", 17, 150]) // returns false Tips:Remember that to create a function we use the word Function In the information array, the user’s age comes first, according to the height (which is in centimeters) To access the position of an array hit put the name followed by brackets: array[1]
Higher Function (user) {
*if (usuario[1] >= 18 && usuario[2] >= 170)* {
return true;
}
else {
return false;
}
}
var usuario1 = ['Et from Estonia', 17, 170]; var usuario2 = ['Swamp Person', 39, 198]; var usuario3 = ['Moon Man Turned', 21, 149]; var usuario4 = ['Pequena Paulistana', 18, 171]; var usuario5 = ['Boy Gate', 13, 142];
//var result = highest (user 1);
console.log("user 1 = " +highest (user 1)); console.log("user2 = " +mayAlto(user2)); console.log("user3 = " +mayAlto(user3)); console.log("user4 = " +mayAlto(user4)); console.log("user5 = " +highest(user5));
This answers your question? Problem Solving in Javascript
– Leo Letto