-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[wedptmad0418] Edna Domingos #134
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
ta-web-mad
left a comment
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.
Dale un repasillo a lo que te he puesto Edna, por lo demás, muy buen trabajo! 👍
|
|
||
|
|
||
| hacker1=hacker1.toUpperCase() + ""; | ||
|
|
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.
Por qué concatenas comillas al final?, las comillas sin espacio es igual a nada. No son necesarias
|
|
||
| space = "", | ||
| navegator = hacker1.split(space); | ||
|
|
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.
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; | ||
| } | ||
|
|
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.
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); | ||
|
|
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.
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]; | ||
| } | ||
| } | ||
|
|
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.
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; | ||
| } | ||
| } |
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.
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
|
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. |
|
This pull request is closed. Thank you. |
No description provided.