Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!