forked from sumitkumar2019/CompleteJavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodules.js
More file actions
32 lines (29 loc) · 854 Bytes
/
modules.js
File metadata and controls
32 lines (29 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* ***********************
* Modules: Advantages:-
* ***********************
* Increase maintainibility
* Reuse
* Abstract
*
* *********************
* Available Modules:-
* *********************
* AMD: Asynchronous module definition : used in browser only
* UMD: Universal module definition : used in browser/Node js
* *********************
* CommonJS: : used in node js only
* ES6 Modules: from ES6 javascript natively supports modules : used in browsers
* *********************
*/
/**Common JS modules */
const Circle = require('./index.js');
const c = new Circle(10);
c.draw();
console.log(c);
/**ES6 Modules: not work with node: see es6module.js and index.html
*
* special note: define type="module" in src tag of html page where we are loading the script file
* <script type="module" src="es6module.js"></script>
*
*/