the script is loaded ★ Variables in the top-level scope become global variables ★ Not strict mode by default ★ import and export keywords ★ Evaluated only once ★ Variables in the top-level scope don’t become global variables ★ 'use strict' by default ES Modules ES Modules Regular Scripts Regular Scripts
the script is loaded ★ Variables in the top-level scope become global variables ★ Not strict mode by default ★ import and export keywords ★ Evaluated only once ★ Variables in the top-level scope don’t become global variables ★ 'use strict' by default ES Modules ES Modules Regular Scripts Regular Scripts
and export keywords ★ Evaluated only once ★ Variables in the top-level scope don’t become global variables ★ 'use strict' by default ★ import and export not available ★ Evaluated every time the script is loaded ★ Variables in the top-level scope become global variables ★ Not strict mode by default
and export keywords ★ Evaluated only once ★ Variables in the top-level scope don’t become global variables ★ 'use strict' by default ★ import and export not available ★ Evaluated every time the script is loaded ★ Variables in the top-level scope become global variables ★ Not strict mode by default
Variables in the top-level scope don’t become global variables ★ 'use strict' by default ES Modules ES Modules Regular Scripts Regular Scripts ★ import and export not available ★ Evaluated every time the script is loaded ★ Variables in the top-level scope become global variables ★ Not strict mode by default
supported ★ Deferred by default, even for inline modules ★ Always fetched with CORS ❌ import greet from 'greet.mjs'; ✅ import greet from '/greet.mjs'; ✅ import greet from './greet.mjs'; ✅ import greet from '../greet.mjs'; ✅ import greet from 'https://example.com/greet.mjs';
in the code ★ Can be used inside classic scripts ★ Can be statically analyzed (helpful for build tools) ★ Can only be used at the top-level scope of a file ★ Can only be used inside module scripts Static Imports Static Imports Dynamic Imports Dynamic Imports
in the code ★ Can be used inside classic scripts ★ Can be statically analyzed (helpful for build tools) ★ Can only be used at the top-level scope of a file ★ Can only be used inside module scripts Static Imports Static Imports Dynamic Imports Dynamic Imports
be statically analyzed (helpful for build tools) ★ Can only be used at the top-level scope of a file ★ Can only be used inside module scripts ★ Can load modules on-demand ★ Can be called anywhere in the code ★ Can be used inside classic scripts
= input.match(pattern); const year = matched.groups.year; const month = matched.groups.month; Named Capture Groups Named Capture Groups Named Capture Groups
= input.match(pattern); const year = matched.groups.year; const month = matched.groups.month; const {year, month} = matched.groups; Named Capture Groups Named Capture Groups Named Capture Groups
formal proposal of the feature ★ Championed by a member of TC39 ★ Problem is clearly identified ★ Example solutions and API ★ Discussion of semantics, algorithms, and potential obstacles