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

196
Views
Método de llamada de JavaScript que no devuelve el valor correcto

 const flightName = { airline: 'luftansa', itaCode: 'LH', book: function(flightname, text) { console.log(`This is ${flightname},${text}`); } } flightName.book('indigo', 'johnny'); let book1 = flightName.book; book1.call('Johnny', 'King');

Producción:

 This is indigo,johnny This is King,undefined
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Prueba esto

 const flightName ={ airline: 'luftansa', itaCode: 'LH', book: function(flightname,text) { console.log(`This is ${flightname},${text}`); } } flightName.book('indigo','johnny'); let book1 = flightName.book; book1.call(this, 'Johnny','King');
about 4 years ago · Juan Pablo Isaza Report

0

está llamando incorrectamente a su función de llamada, se supone que la función de llamada no funciona de esa manera, como se indica en el documento: debe usarla de esta manera:

 call() call(thisArg) call(thisArg, arg1) call(thisArg, arg1, arg2)

entonces necesitas cambiar tu código a:

 book1.call(flightName,'johny', 'king');
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!