Skip to content

PP-WDFT-MEX-CARLOS-GONZALEZ-ESTEBAN-GUTIERREZ - #618

Closed
estebgtzmtz wants to merge 1 commit into
ironhack-labs:masterfrom
estebgtzmtz:master
Closed

PP-WDFT-MEX-CARLOS-GONZALEZ-ESTEBAN-GUTIERREZ#618
estebgtzmtz wants to merge 1 commit into
ironhack-labs:masterfrom
estebgtzmtz:master

Conversation

@estebgtzmtz

Copy link
Copy Markdown

para resolver el palindromo usamos un replace para tener un string sin espacios y comparamos ambos strings, para ordenar usamos el metodo sort de arrays y asi comparar el lugar en el que estaba el hacker1 y el hacker2, no se si sea el mejor metodo pero fue el que nos funciono

Signed-off-by: Esteban <esteb.gtz.mtz@hotmail.com>
Comment thread js/index.js
}

// Iteration 3
console.log(hacker1.split('').join(' ').toUpperCase())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

esto esta bien por que no especificaba que tenian que hacer pero la mejor practica es hacer una funcion y consologearla.

let str = ""; for(i = 0; i < hacker1.length; i++){ if(i < hacker1.length-1){ str += ${hacker1[i].toUpperCase()} } else { str +=${hacker1[i].toUpperCase()}; } }

En este caso se crea una nueva variable, se recorre el nombre del hacker en la funcion y se van agregando las letras capitalizadas con un espacio a la variable, y si ya se recorrieron todas las letras entonces ya no se agrega el espacio.

Comment thread js/index.js

// Iteration 3
console.log(hacker1.split('').join(' ').toUpperCase())
console.log(hacker1.split('').reverse().join(''))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

esto esta bien por que no especificaba que tenian que hacer pero la mejor practica es hacer una funcion y consologearla.

let str2 = "" for(i = hacker2.length-1; i >= 0; i--){ str2 += ${hacker2[i]} } console.log(str2)

En este caso creamos una variable vacia, recorremos el nombre en direccion inversa y vamos agregandolo a la variable nueva.

Comment thread js/index.js
console.log('What?! You both have the same name')
} else if (names[0] === hacker2) {
console.log('Yo, the navigator goes first')
} else if (names[0] === hacker1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@ta-web-mex ta-web-mex left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Buen trabajo chicos! completaron todo, sigan asi!

Happy Coding! 🙂

@ta-web-mex ta-web-mex closed this Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants