DEV Community

[Comment from a deleted post]
Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Actually, there are two variants of vanilla JS on web browser.

  1. The older one without import, and rely on <script src=""> and attaching to Window object. (And IIFE, if you want to avoid polluting the global scope. As well as, you might want to add "use strict" at the top of JavaScript)
  2. The newer one with import, and rely on <script type="module">. This one will not pollute the global scope, nor window object by default. Also, strict by default. As well as, it may be more performant.

Deno tries to follow the second pattern as well. However, Node.js has a different thing, commonjs. ESM is just a recent addition.