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

92
Views
JS ES6 import and then loop

I'm importing multiple classes like below. It's working fine however is there a way to loop App? So that I dont need to copy paste it everytime. That way is more dynamic if i add a new export in app.js.

import * as App from 'app.js';

const load = new App.Load();
const tooltip = new App.Tooltip();
const pagination = new App.Pagination();
const search = new App.Search();
const modal = new App.Modal();
const error = new App.Error();

if I loop it all the classes are visible.

for (const class in App) {
  console.log(class);
};

In the loop it needs to have someting like;

const [class] = new App.[class]();
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!