Skip to content

Conversation

@ednadv
Copy link

@ednadv ednadv commented Apr 30, 2018

No description provided.

Copy link

@ta-web-mad ta-web-mad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dale un repasillo a lo que te he puesto Edna, por lo demás, muy buen trabajo! 👍



hacker1=hacker1.toUpperCase() + "";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Por qué concatenas comillas al final?, las comillas sin espacio es igual a nada. No son necesarias


space = "",
navegator = hacker1.split(space);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Está bien igualar variables para acortar lo que tienes que escribir, pero en el caso de tu variable 'space', que además has olvidado declarar el tipo de variable (var), escribes más poniendo 'space' que las comillas.
Podías haberlo hecho igual con:
var navigator = hacker1.split("")

o += s[i];
return o;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien hecho, pero intenta usar nombres de variables que definan bien el sentido que tienen, s podría ser mejor string y la o podría ser mejor newString. Una vez que sabes cómo invertir la cadena manualmente, échale un ojo a las funciones split( ), reverse( ) y join( )

navegator = hacker1.split(space);

console.log(navegator);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Te falta pasarlo a cadena y separar cada letra por espacios. La función split( ) convierte la cadena sobre la que estás trabajando en un array separando cada elemento en función del argumento que le des a split( )

cadenaSinEspacios += letrasEspacios[i];
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Por qué has usado for...in y no el otro bucle for?

// Alguna letra es distinta, por lo que ya no es un palindromo
iguales = false;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Para ahorrar líneas si niegas la primera condición te ahorras el else:
if(!letras[i] === letrasReves[i]){ iguales = false break }
Y deberías usar para estos casos una igualación estricta '===' en vez de una igualación simple '=='
Y cuando se cumpla la condición que no quieres, hacer un break, para salir del bucle, ya que sabes que no van a ser palíndromos

@stale
Copy link

stale bot commented Dec 17, 2019

This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 17, 2019
@stale
Copy link

stale bot commented Dec 19, 2019

This pull request is closed. Thank you.

@stale stale bot closed this Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants