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

276
Views
¿Cómo eliminar el objeto y todas las referencias?

Usamos la delete cuando necesitamos eliminar la referencia del objeto. Pero, ¿hay alguna forma en JS de eliminar todo el objeto y todas las referencias?

Ejemplo:

 let obj = { a: 3 } let arr = [obj]; let brr = [obj];

Si cambiara los elementos obj en las matrices, también se cambiarían. Además, puedo usar delete arr[0] para eliminar la referencia. Pero quiero eliminar el obj y quiero que también se eliminen los elementos de las matrices.

Algo como:

 // Before: let obj = { a: 3 } let arr = [obj]; let brr = [obj]; arr.length==1 // true brr.length==1 // true // Deleting: delete(obj) // After: arr.length==0 // true brr.length==0 // true
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

No.

La única forma de eliminar un objeto en JavaScript es ubicar y eliminar cada referencia a él.

No existe un mecanismo genérico para comenzar con un objeto y eliminar automáticamente todas las referencias a él.

about 4 years ago · Santiago Trujillo 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!