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

199
Views
How do I resolve the error I have in my JavaScript using imports?

I'm attempting to import a function from 2 different files into another one of my JavaScript files, but in the file that's importing the functions, I'm getting the error that each function is declared, but never read.

capital.js file:

function capital(string) {
  const capitalizedString =
    string.substring(0, 1).toUpperCase() + string.substring(1);
  return capitalizedString;
}

alert(capital("Jon"));

export default capital;

addDOMContent.js file:

function addDOMContent(content) {
  const node = document.createElement("h1");
  node.innerText = content;
  document.body.appendChild(node);
}
addDOMContent("Success!");

export default addDOMContent;

index.js file:

import capital from "./capital.js";
import addDOMContent from "./addDOMContent.js";

Why aren't my files being properly imported?

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!