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

260
Views
¿Cómo funciona este método de puesta en cola en Queue?
class Node { constructor(value) { this.value = value; this.next = null; } } class Queue { constructor() { this.first = null; this.last = null; this.length = 0; } enqueue(value) { const newNode = new Node(value); if(this.length === 0){ this.first = newNode; this.last = newNode; }else{ // How these two lines can create nested object? this.last.next = newNode; this.last = newNode; } this.length++; } } const myQueue = new Queue(); myQueue.enqueue('Joy'); ... myQueue.enqueue('Samir'); // Output this.first { value: "Joy", next: { value: "Matt", next: { value: "Pavel", next: { value: "Samir", next: null, }, }, }, };

Esas dos líneas me confundieron mucho y no las entendí. Como entiendo el método de eliminación de cola, eliminé su código. Agradecería si alguien pudiera explicarme esto.

Como había puesto todo mi código para que se entendiera mejor, he repetido estas líneas. Había puesto todo mi código para que se entendiera mejor, he repetido estas líneas. Como había puesto todo mi código para que se entendiera mejor, he repetido estas líneas. Como había puesto todo mi código para que se entendiera mejor, he repetido estas líneas

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!