[webptmad0418] Rulo - #141
Conversation
ta-web-mad
left a comment
There was a problem hiding this comment.
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.
Buena esa, has usado la función trim( ) 👍
| result += hacker1[i]; | ||
| } | ||
| console.log(result); | ||
|
|
There was a problem hiding this comment.
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.
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.
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.
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;
}
|
|
||
| // Lorem ipsum generator | ||
| var etCount = chiquitum.match(/et/g).length; | ||
| var fistroCount = chiquitum.match(/fistro/g).length; |
There was a problem hiding this comment.
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; | ||
| } | ||
| } |
|
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.