-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[webptmat0418] - Georgina & Carlos #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Removed duplicated text
Extra Resources added
…with-test starter-code-with-tests
…one" but the test is expecting for the string itself, i change the Readme file wich is the quck fix, but may be could be good to change the spec file to not confuse the student.
…tion-fix the test are waiting for undefined but the description says false
…rd-fix find-longest-word-little-fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dadle un repasillo e intentad hacer el ejercicio del array 2d de nuevo. Ánimo!
} | ||
|
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muy bien, echadle un ojo a Math.max( ) y recordad que return te saca de la función, así que podéis quitar el else y dejar el 'return b' fuera
words.splice(secondPosition, 1) | ||
} | ||
} | ||
return words; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es correcto, también podéis hacer la evaluación con el indexOf( ) dentro, así ahorráis algunas líneas. Probad a ver si os gusta :D
} | ||
|
||
return wordExists; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muy bien, el método includes( ) es súper útil también para realizar este ejercicio, echadle un ojo
} else { | ||
return repetitionCounter; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supongo que la comprobación de la línea 183 es si 'array' está vacío. La evaluación se hace con '==' o con '===', no con un solo '='. Y es más efectivo que lo hagáis al principio de la función, porque así no ejecutáis más código de la cuenta. Y también es mejor si la evaluación la hacéis con 'array.length' ya que si es igual a 0, la evaluación se toma como false y podéis continuar con el return false.
También podéis probar a hacer con un filter( ) y un length a dicho filter, a ver si os gusta
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Varias cosas; falta el return, con lo que si llamamos a la función no devuelve nada. El límite de ambos for no debes marcarlos con 20. Aunque sepas que la prueba se hace con un array 2d de 20 x 20, puedo darte un array más grande o más pequeño; así que mejor usad array.length como tope.
Más cositas, el ejercicio no devuelve el resultado correcto, ya que el valor que almacena tu variable 'valor' es el del valor único más alto (da como resultado 99) y no el del producto de los cuatro adyacentes más alto. Aunque tienes un for para multiplicar los valores adyacentes, éste no da buen resultado porque ese array siempre tiene un único elemento. Vuestro fallo está probablemente en todos los if...else, ya que solo entra en una evaluación cada vez y hace un solo push por vuelta.
} | ||
return highestProduct; | ||
} | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Y aquí me temo que el resultado tampoco es el correcto, os recomiendo probar con arrays 2d que cumplan el mínimo, como uno de 4 x 4
We finished the last function (bonus quest) at home independently so I we reviewed each other's function, I have put both in the code