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

238
Views
¿Qué hace invocar el método de llamada dentro de otra función constructora?

Tengo dos funciones de constructor aquí: Car y Van

 var Car = function (location) { this.loc = location }; Car.prototype.move = function () { this.loc++ } var Van = function (location) { Car.call(this, location) }

¿Podría decirme qué está haciendo esta línea Car.call(this, location) ? Mi suposición es que queremos heredar la propiedad loc de la clase Car a la clase Van.

Mi confusión es sobre lo que ahora esta dentro

 Car.call(this, location)

se refiere a? y tambien lo que esta dentro del carro

 var Car = function (location) { this.loc = location };

se refiere a? ¿Alguien puede proporcionar alguna idea?

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

0

Car.call(this, location)

esto asociará la propiedad .loc al objeto Van. this aquí se refiere a la Van . Si crea una instancia de Van , asociará el mismo

 var v = new Van(1); // v.loc=1
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!