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

101
Views
reaccionar creando objetos nativos con matrices

tengo matrices como esta:

 [ 0: {barcode: '4124121241241', qty: 1} 1: {barcode: '1234124135134', qty: 1} 2: {barcode: '3573424625234', qty: 1} 3: {barcode: '2346468457354', qty: 1} 4: {barcode: '5684452043432', qty: 1} 5: {barcode: '1241263475686', qty: 5} 6: {barcode: '1231241231423', qty: 15} ]

y estoy empujando esos como este:

 shelfArray.push({ [rafName]:JSON.parse(results.rows.item(index).BarcodeArray) });

esta es mi salida:

 0: Q1: BarcodeArray: [{…}] 1: Q2: BarcodeArray: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}] 2: {Q3: null}

pero quiero esto como:

 Q1: BarcodeArray: [{…}] Q2: BarcodeArray: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}] 2: {Q3: null}

como puedo hacer eso

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En lugar de crear shelfArray como una matriz [] , créelo como un objeto vacío

 const shelfArray = {}; // rather than `= [];`

y luego agregue claves a ese objeto a medida que realiza un bucle en lugar de presionar usando la notación de corchetes :

 shelfArray[rafName] = JSON.parse(results.rows.item(index).BarcodeArray);
about 4 years ago · Juan Pablo Isaza 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!