-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[webptmad0418] Rulo #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[webptmad0418] Rulo #141
Conversation
There was a problem hiding this comment.
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()); | ||
|
There was a problem hiding this comment.
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); | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; | ||
} | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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;
}
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bien pensado! 👍
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. |
This pull request is closed. Thank you. |
No description provided.