include()
Description
The include()
function is designed to include the content of one script file into another. This allows using code from one file (for example, library functions or classes) in another without having to copy this code manually.
Syntax
JSinclude(path: String) -> void
Parameters
Parameter |
Type |
Description |
path |
String |
Path to the script file that needs to be included. |
Path Types
Type of Path |
Example |
Description |
Absolute |
"C:/scripts/library.js" |
The full path to a file on disk. |
Relative |
"../config/settings.js" |
A path relative to the current executing file. |
Return value
Type |
Description |
void |
Empty value. |
Example
JS |
---|
| // Including a file by its full path
include("c:/scripts/script.js");
// Including a file script2.js from the same directory
include("./script2.js");
// Including a file script3.js from the parent directory
include("../script3.js");
|
Last update: 14 August 2025, 18:47