Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
Is it necessary to include the argument in the callback function of Promise.prototype.catch()?

Background

According to the MDN docs, Promise.prototype.catch() takes a parameter called onRejected, which is a function that is called when the Promise is rejected. (Internally, this calls Promise.prototype.then(undefined, onRejected).)

According to the docs, onRejected “has” one parameter, reason, which is the rejection reason. In the examples given, this parameter is always present.

E.g.,

p.catch(function(e) {
  console.error(e);
})

Question

I am writing code where I do not want to use the reason parameter, so something like this:

p.catch(function(e) {
  foo();
})

Is it better practice to leave in the e parameter, since according to the docs onRejected is supposed to have it? (ESLint will also complain about this).

Or is it common practice to remove it? As in

p.catch(function() {
  foo();
})

PS: I know about optional catch binding, but that is for try-catch blocks.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda