Hi, I am newbie here… I had some problems with Bob exercise while studing Typescript… message.trim() doesnt work properly/well, so I needed to use regular expressions… this is my code (message.length == 0 or replace doesnt work, but replace worked into the function console.log() that is strange!) , hope this threat could be useful for the community, thanks! ```
export function hey(message: string): string {
/** Uso un auxiliar porque los otros métodos no están funcionando **/
let aux:string = message.replace(/ /g, “”);
console.log(aux + “–”);
if(esSilencio(aux))
{
return “Fine. Be that way!”;
}
else if(aux.endsWith(“?”) && esMayusc(aux))
{
return “Calm down, I know what I’m doing!”;
}
else if(esMayusc(aux))
{
return “Whoa, chill out!”;
}
else if(aux.endsWith(“?”))
{
return “Sure.”;
}
return “Whatever.”;
};
function esMayusc(message: string): boolean {
let aux:string = message;
if(aux.toUpperCase() == message && aux.toLowerCase() != message)
{
console.log(aux);
return true;
}
return false;
};
function esSilencio(input: string ): boolean {
return /^\s*$/.test(input);
}