Solución
solution.tsTypeScript
function trim(text: string): string {
let start = 0;
let end = text.length - 1;
while(start <= end && /\s/.test(text[start])) {
start++;
}
while(end >= start && /\s/.test(text[end])) {
end--;
}
return text.slice(start, end+1);
}
// No modificar: necesario para evaluar el resultado.
export { trim };0respuestas