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

272
Views
Embedded script does not recognize the variable defined in external script

HTML code:

<!DOCTYPE html>
<html>
  <head>
    <title>VAST Client JS Test</title>
    <meta charset="UTF-8" />
    <script
      type="text/javascript"
      src="src/vast-client-browser.min.js"
    ></script>
  </head>

  <body>
    <div id="app"></div>
    <script type="text/javascript">
      // display a text on the page.
      document.getElementById("app").innerHTML = "Step 1";

      var vastClient = new VAST.VASTClient();

      // display a text on the page.
      document.getElementById("app").innerHTML = "Step 2";

    </script>
  </body>
</html>


I put the js file into the src folder.

However, it doesnt work as expected.

As you see above, on my HTML file, I print "Step 1" and "Step 2" text. However, it does not show the text "Step 2" since It was used after using the variable in my JS file.

enter image description here

Also, I get a warning message like "'VAST' is assigned a value but never used."

Please check out my codesandbox demo.

What could I be missing?

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!