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

279
Vistas
What does it mean when a function is written like "name: function ()"?

I just have a super quick question about JavaScript so I'm not going to follow the general formatting of a question like usual.

I'm trying to understand some code in JavaScript, and the person who wrote it used a method that I'm not familiar with. As you see in the title, they've written it by typing the name of the function followed by a colon first, and then writing the actual function.

Example: myFunction: function () {}

Is anyone able to tell me what this means, why it's done, and what it accomplishes?

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

It is part of Object Methods like:

const person = {
  myFunction: function() {}
};

you can invoke myfunction by using person.myFunction()

about 4 years ago · Santiago Trujillo Denunciar

0

There are 3 ways of writing a function in JavaScript:

function myFunction() {} // Function Declaration
myFunction: function () {} // Function Expression
myFunction = () => {} // Arrow Function
about 4 years ago · Santiago Trujillo 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