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

162
Views
Is there any alternative way to access JavaScript globals that have been shadowed or redefined?

For some unknown reason the name URL in my event handler points to a string value with the current URL of the browser instead of the constructor for an URL object. Trying to call it results in the following error:

Uncaught TypeError: URL is not a constructor

The string URL does not appear anywhere in the loaded document which leads me to believe that it is not redefined anywhere in my program. I have not been able to find anything other that would explain why this phenomena occurs.

So my question for a workaround is: Is it possible to access these global constructors in any other way?

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

0

Yes, through the name window, as long as it too hasn't been shadowed or redefined:

let a = new window.URL(location);
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!