Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Dalvmar
Copy link

@Dalvmar Dalvmar commented Jun 12, 2018

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

@@ -11,13 +18,46 @@ var words = [
'crackpot'
];

// Calculating a Sum
function findLongestWord(){
Copy link
Contributor

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 = "";

Copy link
Contributor

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));
Copy link
Contributor

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);
Copy link
Contributor

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)

Copy link
Contributor

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)
Copy link
Contributor

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)
}

@ta-web-mad
Copy link
Contributor

Buen trabajo chicos, miráis las correcciones que ve he mandado para resolver los errores.
Ben Fatto! 👍😁#checked #closed #GioЯgio

@ta-web-mad ta-web-mad closed this Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants