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

99
Views
Desestructuración indefinida dentro de un objeto frente a una matriz

El siguiente código da un objeto vacío {} :

 { 2, {...undefined}}

Pero, ¿por qué el siguiente código da error: Uncaught TypeError: undefined is not iterable ?

 { 2, [...undefined]}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No puede desestructurar una matriz si no es una matriz con seguridad. Está bien tener una matriz vacía, por lo que el valor dado no estará definido.

Puede usar esto para evitar el acceso a un valor indefinido O no iterable:

 const a = undefined console.log(...(a ?? []))
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!