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

240
Views
La lista vinculada con javascript muestra [Objeto] como valor en lugar de objeto serializado

Estoy tratando de construir una lista vinculada usando una Class con JS. Dentro de mi Class , tengo una función llamada checkForEmptyNext() que recorre la lista y busca el nodo con next: property of null La función debe llamarse recursivamente a sí misma hasta que encuentre el node correcto

Lista enlazada

 // 10 --> 15 --> 16 class LinkedList { constructor(value){ this.head = { value: value, next: null } this.tail = this.head; this.length = 1; } append(value){ if(this.head.next === null){ this.head.next = { value, next: null } this.tail = this.head.next; this.length++ }else{ this.checkForEmptyNext(value, this.head.next) } } checkForEmptyNext(value, node){ if(node.next === null){ node.next = { value, next: null } this.tail = node.next; this.length++ }else{ this.checkForEmptyNext(value, node.next) } } } const linked = new LinkedList(10); linked.append(5) linked.append(16) console.log(linked)

El console.log está mostrando:

 LinkedList { head: { value: 10, next: { value: 5, next: [Object] } }, tail: { value: 16, next: null }, length: 3 }

¿Por qué veo [Object] en lugar del valor serializado real?

about 4 years ago · Juan Pablo Isaza
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!