Created
August 20, 2018 20:05
-
-
Save FranciscoTorreblanca/28b677690411aa756c4097c0bbb6262c to your computer and use it in GitHub Desktop.
Irving, Francisco
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hacker1 = { | |
nombre: "john" | |
} | |
var hacker2 = { | |
nombre: null | |
} | |
console.log("NOmbre de hacker1 es: " + hacker1.nombre) | |
hacker2.nombre = prompt("Nombre: ") | |
console.log("NOmbre de hacker2 es: "+hacker2.nombre) | |
if (hacker1.nombre.length > hacker2.nombre.length) { | |
console.log("hacker1 es más largo. Tiene "+hacker1.nombre.length + " caracteres") | |
nombreMas=hacker1 | |
} else if (hacker1.nombre.length === hacker2.nombre.length){ | |
console.log("TIenen los mismos caracteres") | |
} | |
else{ | |
console.log("hacker2 es más largo. Tiene "+hacker2.nombre.length + " caracteres") | |
} | |
for(caracter of hacker1.nombre){ | |
console.log(caracter.toUpperCase() + " " ) | |
} | |
for(i=hacker2.nombre.length-1;i>=0; i--){ | |
console.log(hacker2.nombre[i]) | |
} | |
var input = prompt("Palindromo: ") //string 1 | |
var alrevez="" //sting2 | |
var inputSE = "" | |
for (caracter of input){ | |
if (caracter===" " || caracter===","){ | |
inputSE +="" | |
}else { | |
inputSE+=caracter | |
} | |
} | |
for(j=input.length-1;j>=0; j--){ | |
alrevez+=input[j] | |
} | |
console.log(alrevez) | |
console.log(input) | |
if(alrevez===input){ | |
console.log ("PALINDROMO!!") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excelente trabajo!
Comentarios: