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

261
Views
Number Error: identifier expected when module exporting

I'm trying to import values of numbers from 1 to 20 to another js file [Index.js] here's my current code:

const what = {};

what. 1 = { number: 1 };
what. 2 = { number: 2};
what. 3 = { number: 3}

module.exports = what;

I have an error of: identifier expected is there a way to fix this error? so I can import the values to my other script? please let me know :)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try to change your code like this:

module.exports = {
    1: { number: 1 },
    2: { number: 2 },
    3: { number: 3 },
};

You should then be able to access the properties with:

const obj = require('./path/to/file');
console.log(obj[1].number);
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!