Añadiendo arreglos con EsLint#80
Añadiendo arreglos con EsLint#80Azur-Azabache wants to merge 3 commits intoLaboratoria-learning:masterfrom
Conversation
|
@developerVilchez eslint OK |
nicolethenerd
left a comment
There was a problem hiding this comment.
¡Gran comienzo! Tu código está bien organizado y es fácil de leer. Desfortunadamente, todavía no funciona para cifrar y decifrar strings.
Las funciones cipher y decipher debe devolver strings, por ejemplo:
cipher('HOLA'); // --> 'OVSH' decipher('OVSH'); // --> 'HOLA'
JS/app.js
Outdated
There was a problem hiding this comment.
JS/app.js
Outdated
There was a problem hiding this comment.
usa 'var' para declarar una nueva variable
for (var i = 0;
espacio antes de i++
for (i = 0; i <= array.length - 1; i++) {
JS/app.js
Outdated
There was a problem hiding this comment.
No estás usando este parámetro 'str'
Debes reemplazar 'phrase' con 'str' dentro de esta función
JS/app.js
Outdated
There was a problem hiding this comment.
Prefiero i < array.length a i <= array.length - 1
JS/app.js
Outdated
There was a problem hiding this comment.
Es importante que declares newarray dentro de la función cipher (por ejemplo, en la linea 6). De lo contrario, si ejecutas el código dos veces, el arreglo contendrá letras de ambas palabras.
JS/app.js
Outdated
There was a problem hiding this comment.
La resulta de la función cipher debe ser un string - esta variable sería mejor llamada algo así como encodedPhrase.
JS/app.js
Outdated
There was a problem hiding this comment.
El parámetro aquí debe ser string. decipher debe funcionar como así:
decipher('OVSH'); // --> 'HOLA'
JS/app.js
Outdated
There was a problem hiding this comment.
El return debe ser fuera del loop. Ahora, esta función devuelta el arreglo después del primer iteración del loop.
JS/app.js
Outdated
There was a problem hiding this comment.
No necesitas una else vacío.
JS/app.js
Outdated
There was a problem hiding this comment.
¿Qué está tratando de hacer aquí? Este código prueba si phrase es un número.
También, no necesitas === false - puedes usar un !, así :
if (!isNaN(phrase))
Pamela Rojas