Skip to main content

ScriptCode fragment run in Global Scope by Browser

aka Scripts

Scripts were precursors of Module

before ES6, Module not added - only Scripts existed, typically via IIFE wrapper

!deprecated Exporting Scripts (before ES6)

<script src="my-iife-module.js"</script\>
var myModule = (function () {
var importFunc1 = otherModule.importFunc1
var importFunc2 = otherModule.importFunc2
function myFunc() {}
function exportFunc() {
importFunc1()
importFunc2()
myFunc()
}
return {
exportFunc: exportFunc
}
})()

References

  1. Same-Origin ↔ (policy) to block Web Page/Script to access Web Resource from different Origin

  2. Git Hooks ↔ JS Script to trigger on/before git event

  3. useScript()Custom Hook to Dynamically load external Script

  4. .batWinOS DOS batch file to run Script via cmd.exe

  5. .vbs ↔ Virtual Basic Script to run VBScript to automate WinOS Processes or IE-specific tasks

  6. Web Workers APIWeb API to run Script in Background Thread separate Thread of main App for better perf