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

100
Views
¿La función de devolución de llamada es esencialmente una función dentro de otra función?

¿Por qué está mal esto?

 markImportant({ Id: this.row.Id }) .then(this.showToast("success")) .catch(this.showToast("error"));

¿Y esto es correcto?

 markImportant({ Id: this.row.Id }) .then(() => { this.showToast("success"); }) .catch(() => { this.showToast("error"); });

Estoy pasando una función como parámetro en ambos casos. El primer caso es solo una función, mientras que la segunda función es una función dentro de otra función como parámetro.

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

0

en .then(this.showToast("success")) está invocando la función showToast que creo que devuelve indefinido, por lo que no puede invocar undefined

en then(() => { this.showToast("success")}) está pasando una función que se puede invocar, por eso funciona

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!