Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

277
Vistas
¿Cómo uso forEach para convertir una matriz de cadenas en una sola cadena?
/*Your task in this activity is to implement a function called createParagraph that takes an array of strings, and returns a single string containing all the items in the array separated by a space.*/ 

 /*Your task in this activity is to implement a function called createParagraph that takes an array of strings, and returns a single string containing all the items in the array separated by a space.*/ //Use forEach to create a single paragraph from a list of words. // This is a list of words let words = ['Loops', 'are', 'a', 'great', 'way', 'to', 'find', 'elements', 'in', 'an', 'array']; // TODO: implement this function to return a string containing all words in a paragraph. function createParagraph(words) { let paragraph = ''; return paragraph.forEach(words); } // Prints paragraph to console console.log(createParagraph(words)); // don't change this line if (typeof module !== 'undefined') { module.exports = createParagraph; }

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No puede usar forEach en strings . forEach está destinado a ser utilizado con arrays

Puede hacer uso de join aquí para unirse a una matriz.

 let words = [ 'Loops', 'are', 'a', 'great', 'way', 'to', 'find', 'elements', 'in', 'an', 'array', ]; function createParagraph(words) { return words.join(' '); } console.log(createParagraph(words));

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda