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

235
Views
what is the difference between grouping similar methods as class static methods or object members?

In javascript, I have these two approaches to group similar methods:

first approach:

class GroupedMethodsWithClass {
  static a = () => {
    console.log("a")
  };

  static b = () => {
    console.log("b")
  }
}

and the second one:

const GroupedMethodsWithObject = {
  a() {
    console.log("a");
  },
  b() {
    console.log("b");
  },
}

Right now I only know that I have the class static initialization block option with first approach:

class GroupedMethodsWithClass {
  static a = () => {
      console.log("a")
  }
  static b = () => {
      console.log("b")
  }
  static {
    console.log('Class static initialization block called');
  }
}

But does anyone knows what are the real differences between these two approaches?

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!