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

110
Vistas
How to convert 2 object into single one

i've got 2 objects

const size = shoppingCart.map((el) => ({size: el.size}));

The first one is filteredProducts list:

    const filteredProducts = [
    {
        description: "Material: 100% cotton\nCare instructions: Do not tumble dry, machine wash at 30 ° C, machine wash on gentle cycle",
        id: "80005397",
        image: {url: 'h,ttps://www.datocms-assets.com/59095/1638273249-spodnie.png'},
        price: 32.8,
        title: " Pier One Cargo"
    }
]

And second one that is selected size:

  const selectedSize = [
    {
        size: 'L'
    }
]

I have to combine this 2 objects into single one like this:

    const filteredProducts = [
    {
        description: "Material: 100% cotton\nCare instructions: Do not tumble dry, machine wash at 30 ° C, machine wash on gentle cycle",
        id: "80005397",
        image: {url: 'h,ttps://www.datocms-assets.com/59095/1638273249-spodnie.png'},
        price: 32.8,
        title: " Pier One Cargo",
        size: 'L'
    }
]
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You can use map() function and the spread operator:

const filteredProductsWithSize = filteredProducts.map((product, i) => ({
    ...product,
    ...selectedSize[i]
}));
about 4 years ago · Santiago Gelvez 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