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

291
Vistas
For ES6 classes is there a way to log which methods/arguments that were used and then call upon them again?

Currently I have a car class that has a lot of methods on it, most involved with generating parts of the car (door, wheels, cars,etc), and then returns the new car class with the new parts. I'd like to be able to call the class methods, and then log the methods and arguments used, and be able to do a "replay" of generating that car.

The only way I can think of is to insert some code in every method that records what just happened, push this log in an array, and then have a separate bloated method that is a bunch of switch statements that'll call upon the relevant method used. However that seems pretty inefficient and will have to be updated every time a new method is added and become too cumbersome. Is there an easier solution to tackle this?

Also am able to get the method names as strings with

Object.getOwnPropertyNames(Object.getPrototypeOf(dude)    

But this still doesn't solve logging the method used, and then using the method

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