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

161
Vistas
Non Predefined Javascript Function Names and their execution

I'm not sure this kind of feature is available in Javascript. Here is what I wanted to archive.

Let's say we have an object instance called obj and I want to call any function in this object instance but I'm not defining the function name at the beginning.

const obj = {};

obj.functionOne({id: 1}); // execution 1
obj.functionTwo({id: 1}); // execution 2

I wanted to execute one single function (_default) for both execution 1 and execution 2. withing that function I need to know what is the function name actually executed.

eg:


obj = {

  _default: (params) {
    console.log('Function Name is', Function.name); // will be print `functionOne` or `functionTwo`
    console.log(params); // will be print {id: 1} for both cases.
  }

}

Can someone give me some insight on how to archive this kind of requirement?

Thanks in advance.

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