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

subiendo identación app.js #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
"keyword-spacing": 1,
"space-before-function-paren": [1, "never"],
"eqeqeq": 1,
"space-infix-ops": 1,
"comma-spacing": 1,
"brace-style": 1,
"no-multiple-empty-lines": 1,
"camelcase": 1,
"func-call-spacing": 1,
"key-spacing": 1,
"semi": 1,
"no-floating-decimal": 1,
"no-multi-spaces": 1,
"object-property-newline": 1,
"padded-blocks": [1, "never"],
"space-before-blocks": 1,
"space-in-parens": 1,
"spaced-comment": 1,
"quotes": [1, "single"],
"id-length": [1, { "exceptions": ["i", "j", "x"] }],
"indent": [1, 2],
"no-array-constructor": 1
}
}
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cifrado César</title>
</head>
<body>
<script type="text/javascript" src="js/app.js">

</script>

</body>
</html>
30 changes: 30 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Primero creamos un string asignandole el nombre de abecedario->'alphabet'
var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
// transformaremos el string en un array.
var letter = alphabet.split('');
var newLetter = '';

// se creara una nueva variable "word" donde se ingresara la frase o palabra.
do {
var word = prompt('Ingrese texto');
} while (word.length === 0 || !isNaN(word))
for (var i = 0;i < word.length;i++) {

//word[i]- es el elemento de la posicion i
//charAt(i).- es para sacar un carecter de la palabra ingresada.

num=(word.charAt(i)).charCodeAt();

position = letter.indexOf(word.charAt(i));
newposition=(position+num)%26;
newLetter+=letter[newposition-1];
}

//document.write(word[i]);
document.write(newLetter);
//document.write(letter) ;
function cipher(letter){
}
function decipher(num){

}