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

411
Views
How do I export multiple variables, classes or functions at one time?

I have tried to export multiple variables, classes and functions, but I keep getting an error that I have to declare it. Is there any way I can get around this? Here’s the code.

JS:

var exports = [];

for(var module of exports) {
   export module; //This gives me the error.
}

HTML:

<script type=“module” src=“main.js”></script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can not do that because you are not allowed to do that.

Add export to each symbol you want to export:

export var a = 1;
export function f(){}

Or

var a = 1;
function f(){}
export {
    a,
    f,
}
about 4 years ago · Juan Pablo Isaza Report
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!