Hi @danielveraangulo703
Primero como dice @jwilkins.oboe tienes un typo hay un spacio, al principio del array, por eso no reconoce tu resultado pero eso no es todo. Quita esa variable
let newString= ' ';
Segundo no deberias hacer un for in loop porque estas haciendo un metodo split(" ");
y estas cambiando de formato string a un array, y con arrays no puedes usar for in, solo en objetos.
La manera correcta es hacer un for loop para arrays.
for (let i = 0; i < arr.length; i++) {
}
Despues ya solo regresa tu array a un string con el metodo.
yourArray[].join('' '');
Dejanos saber si tienes dudas en el for loop.
Translate.
Hi @danielveraangulo703
First, of all, as @jwilkins.oboe says you have a typo, there is a space, at the beginning of the array, so it doesn’t recognize your result, but that’s not all. Remove that variable
let newString = '';
Second, you shouldn’t do a ** for in ** loop because you’re doing a split (" ");
method and you’re changing from string to array, and with arrays, you can’t use ** for in **, only in objects.
The correct way is to do a for loop for arrays.
for (let i = 0; i <arr.length; i ++) {
}
Then just return your array to a string with the method.
yourArray []. join ('' '');
Let us know if you have questions about the for loop.