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

121
Views
JavaScript Scopes inside inline event handlers

I am trying to execute a function which is dynamically fetched, but I am getting an undefined error. I think it probably has something to do with scope but I don't know the exact problem.

This is code.

<button onmouseover="function load_script(){import('/script.js')};load_script()" onclick="checker()">Click

The script file is located at root and has these contents.

export const checker = () => console.log(2020);

The browser does fetch the script upon mousehover but it cannot find the function checker on click event which makes me think this problem is related to scope but I can't resolve it.

Any ideas?

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!