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

Cifrado Cesar - Manuela Flores #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ManuelaFlores
Copy link

Muchas gracias por revisar mi producto final , espero recibir feedback pronto :)

@Gabx04
Copy link

Gabx04 commented Nov 14, 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 trabajo! Solo tengo algunos pequeños comentarios.

// convirtiendo la cadena de texto a mayúsculas
string = string.toUpperCase();
// newPosition:almacenará las posiciones en el código ASCII de la cadena de texto
var newPosition = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Es posible combinar estos dos loops en uno:

var newString = '';
for (var i = 0; i < string.length; i++) {
    // agregando las posiciones de las letras del string en codigo ASCII a newPosition
    var newPosition = (string.charCodeAt(i) - 13 - 33) % 26 + 65);
    newString += String.fromCharCode(newPosition);
}

// concantenando las letras encriptadas a newString
newString += String.fromCharCode(newPosition[j]);
}
return alert('Su frase descifrada es ' + newString);
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 la función devuelta una cadena. Si quieres usar un alert, usarlo antes del return:

alert('Su frase descifrada es ' + newString);
return newString;

// convirtiendo la cadena de texto a mayúsculas
string = string.toUpperCase();
// newPosition:almacenará las posiciones en el código ASCII de la cadena de texto
var newPosition = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Es posible combinar los dos loops en uno (vea abajo)

newString += String.fromCharCode(newPosition[j]);
}
// retornando cadena de texto encriptada
return alert('Sufrase crifrada es ' + newString);
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 la función devuelta una cadena. Si quieres usar un alert, usarlo antes del return:

alert('Su frase cifrada es ' + newString);
return newString;

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.

5 participants