-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_import.js
More file actions
20 lines (14 loc) · 953 Bytes
/
03_import.js
File metadata and controls
20 lines (14 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Import
// What
// - In JavaScript, the import statement is used to import functionality from other modules. It allows you to access and use functions, variables, or classes defined in separate JavaScript files or modules within your current module.
// Note
// - When you are using `import` for importing the code form the other file (modules). You need to update the file type in the HTML that JavaScript file is the module.
// Syntax
// Importing Class
// - When you import class from one file to another file you can actually set custom name for that ClassName.
// import ClassName from "./fileName" (./ for relative file path)
// import ClassName from "/fileName" (/ for absolute file path)
// Importing selected function
// - When you import function from one file to another file you can actually set custom name for that function.
// import {functionName} from "./fileName"
// import {functionName as customFunctionName} from "./fileName"