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

120
Vistas
Method that will read different settings in the object and depending on the incoming data execute different methods

I study vanila JS, and try to optimize my code. I want to create a universal method that will read different settings and, depending on the incoming data launch another methods. I don’t really want to use with a lot of IF IF ELSE

What I got

Settings = {
SlideToShow: 2,
SlidetoScrolle: 2,
Scrollable: false
}

My "universal" method

_settingsReader(settings) {
        for (const key in settings) {
            if (Object.hasOwnProperty.call(settings, key)) {
                this._set + key + (settings[key])  
}

All problems hide here "this._set + key + (settings[key])". It doesn't call a method.

I just don't understand if something like this is possible. And how to implement it.

Metods that I want to launch

_setSlideToShow(param);
_setSlidetoScrolle(param);
_setScrollable(param);

I hope I was able to explain what I would like to see in the final result. I will be very happy if someone can help me with this problem.

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