Skip to content

Conversation

ruloalonso
Copy link

No description provided.

Copy link

@ta-web-mad ta-web-mad left a 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());

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);

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
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;
}
}

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?

Copy link
Author

@ruloalonso ruloalonso May 4, 2018

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;
}

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;

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;
}
}

Choose a reason for hiding this comment

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

Bien pensado! 👍

@stale
Copy link

stale bot commented Dec 17, 2019

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
Copy link

stale bot commented Dec 19, 2019

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy