Skip to content

[webptmad0418] Rulo - #141

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

[webptmad0418] Rulo#141
ruloalonso wants to merge 1 commit into
ironhack-labs:masterfrom
ruloalonso:master

Conversation

@ruloalonso

Copy link
Copy Markdown

No description provided.

@ta-web-mad ta-web-mad 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.

Dale un repaso a lo que te he comentado, por lo demás, buen trabajo! 👍

result += hacker1[i].toUpperCase() + " ";
}
console.log(result.trim());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Buena esa, has usado la función trim( ) 👍

result += hacker1[i];
}
console.log(result);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Muy bien, ahora que lo sabes hacer manualmente, prueba con split( ), join( ) y reverse( ) para el último caso

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

var hacker1 = 'Tommy';
console.log(hacker1.split("").join(" ").toUpperCase());
console.log(hacker1.split("").reverse().join(""));

mejor??? jeje

if (palindrome[i] !== palindrome[palength - i -1]) {
resultado = false;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No está mal, pero inténtalo sin usar expresiones regulares. Y además, qué pasaría si te doy una frase que contenga @? Contemplas los casos de los ejemplos propuestos en el ejercicio, sabrías generalizarlo más?

@ruloalonso ruloalonso May 4, 2018

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

var palindrome = prompt("Show me your Palindrome");
var valChars = "abcdefghijklmnñopqrstuvwxyz";

palindrome = palindrome.toLowerCase().split("").filter(checkChar);

if (palindrome.join("") === palindrome.reverse().join(""))
console.log("Looks like we got a Palindrome!!");
else
console.log("Have you seen any Palindrome?");

function checkChar(char) {
return valChars.indexOf(char) > 0;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bien pensado! 👍


// Lorem ipsum generator
var etCount = chiquitum.match(/et/g).length;
var fistroCount = chiquitum.match(/fistro/g).length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Es correcto también, pero cómo lo harías sin expresiones regulares? Javascript provée de funciones que te resuelven este problema muy fácilmente

if (palindrome[i] !== palindrome[palength - i -1]) {
resultado = false;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bien pensado! 👍

@stale

stale Bot commented Dec 17, 2019

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale label Dec 17, 2019
@stale

stale Bot commented Dec 19, 2019

Copy link
Copy Markdown

This pull request is closed. Thank you.

@stale stale Bot closed this Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants