0
  1. I noticed that when adding type="module" to a script tag in HTML with src="./someJS.js", variables from this JS file are not accessible from the browser console and appear as undefined. This differs from the same HTML tag without the module indication, where all variables can be perfectly viewed from the browser.

I would like to ask for a detailed explanation regarding this behavior.

  1. Additionally, I would like to ask if using type="module" is mandatory when using an import statement within the JS file I am loading into the HTML or if there is any way to get around this.

Thank you very much!

2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.