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

252
Views
Cómo eliminar un objeto si el valor de la propiedad del objeto anidado es <época

Tengo un árbol de objetos que contiene los siguientes valores.

 data = { TD2n9thHQgyvWdPhOkHQ: { heartbeat: 1644637961658, joinTime: 1644636756368, }, IASJDAIODJiklk243oi: { heartbeat: 1644637961658, joinTime: 1644637961658, } }

Estoy tratando de verificar si el valor de cada latido es 10 segundos menos que la hora actual de la época y, si lo es, elimine el objeto principal.

¡Cualquier ayuda sería muy apreciada!

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

0

data = { TD2n9thHQgyvWdPhOkHQ: { heartbeat: 1644637961658, joinTime: 1644636756368, }, IASJDAIODJiklk243oi: { heartbeat: 1644637961658, joinTime: 1644637961658, } } for(let x in data) { // you have each object console.log(data[x]) // each heartbeat console.log(data[x]['heartbeat']); // each of joining time console.log(data[x]['joinTime']); // you can delete object after your condition satisfy delete data[x]; };
about 4 years ago · Juan Pablo Isaza Report

0

Puede usar el operador de eliminación para eliminar completamente el objeto que desea.

 data = { TD2n9thHQgyvWdPhOkHQ: { heartbeat: 1644637961658, joinTime: 1644636756368, }, IASJDAIODJiklk243oi: { heartbeat: 1644637961658, joinTime: 1644637961658, } } delete data.IASJDAIODJiklk243oi console.log(data)

de esta manera puede eliminar el objeto Entonces, aplique sus condiciones y use el operador de eliminación

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!