Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Añadiendo arreglos con EsLint#80

Open
Azur-Azabache wants to merge 3 commits intoLaboratoria-learning:masterfrom
Azur-Azabache:master
Open

Añadiendo arreglos con EsLint#80
Azur-Azabache wants to merge 3 commits intoLaboratoria-learning:masterfrom
Azur-Azabache:master

Conversation

@Azur-Azabache
Copy link

Pamela Rojas

@Gabx04
Copy link

Gabx04 commented Nov 10, 2017

@developerVilchez eslint OK

Copy link
Collaborator

@nicolethenerd nicolethenerd left a comment

Choose a reason for hiding this comment

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

¡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
Copy link
Collaborator

Choose a reason for hiding this comment

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

JS/app.js Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

No estás usando este parámetro 'str'
Debes reemplazar 'phrase' con 'str' dentro de esta función

JS/app.js Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefiero i < array.length a i <= array.length - 1

JS/app.js Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

El parámetro aquí debe ser string. decipher debe funcionar como así:
decipher('OVSH'); // --> 'HOLA'

JS/app.js Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

No necesitas una else vacío.

JS/app.js Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments