Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
Cómo convertir 2 objetos en uno solo

tengo 2 objetos

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

El primero es la lista de productos filtrados:

 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" } ]

Y el segundo que es el tamaño seleccionado:

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

Tengo que combinar estos 2 objetos en uno solo como este:

 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 answers
Answer question

0

Puede usar la función map () y el operador de propagación :

 const filteredProductsWithSize = filteredProducts.map((product, i) => ({ ...product, ...selectedSize[i] }));
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!