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

191
Vistas
Method declaration difference between foo() {}, and foo: function() {}

are there any kind of difference between these two types of declarations or is it just a short-hand thing?

const bar = {
  foo: function() { return 0 },
}
const bar = {
  foo() { return 0 },
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

An ES5 syntax looks like this:

const var = {
  foo: function() { return 0 }
}

ECMAScript 2015 allows developer to write a shorter syntax for method definitions on objects.

const bar = {
  foo() { return 0 }
}

Both are the same and the second syntax is a shorter and modern approach.

about 4 years ago · Juan Pablo Isaza Denunciar
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