-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[MAD PP] Antonio Esteban & Dunnia Alvarez #430
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
@@ -11,13 +18,46 @@ var words = [ | ||
'crackpot' | ||
]; | ||
|
||
// Calculating a Sum | ||
function findLongestWord(){ |
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.
Aqui hay que pasarle un parametro function findLongestWord(array){
function findLongestWord(){ | ||
var longitud = 0; | ||
var mPalabra = ""; | ||
|
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.
if(words.length==0){
return(undefined)
}
Esta condición falta in muchas funciones, se utiliza para devolver false si un array esta vacío
//}, 0); //Pero si no encuentras nada o no hay siguiente, regresa 0 | ||
//var promedio = sumatoria / array.length; | ||
var reducer = (accumulator, currentValue)=> accumulator + currentValue; | ||
console.log(array.reduce(reducer)); |
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.
Aqui hay que poner return array.reduce(reducer)
function averageNumbers(array) | ||
{ | ||
var reducer = (accumulator, currentValue)=> accumulator + currentValue; | ||
console.log(array.reduce(reducer)/array.length); |
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.
También aqui poner un return array.reduce(reducer)/array.length
var reducer = (accumulator, currentValue)=> accumulator + currentValue; | ||
console.log(array.reduce(reducer)/array.length); | ||
} | ||
averageNumbers(numbersAvg) | ||
|
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.
Falta la la parte de calcular la media de las palabras, una solución puede ser esta
function averageWordLength(arr){
if(arr.length==0){return undefined}
var suma= 0
for(var k=0; k<words.length; k++){
suma += words[k].length;
}
if(words.length !==0){
return parseInt(suma/words.length);
}
}
@@ -59,6 +113,15 @@ var wordsFind = [ | ||
'truth', | ||
'disobedience' | ||
]; | ||
function doesWordExist(array, word) |
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.
os paso la manera mas simple de esta función
function doesWordExist(words, word){
return words.includes(word)
}
Buen trabajo chicos, miráis las correcciones que ve he mandado para resolver los errores. |
Hasta donde he llegado:Todo menos bonus
Dificultad: media-alta
Comentarios:
Hay cosas que no contemplamos y nos da error
El bonus no nos dio tiempo a mirarlo