Modules are used to organize code into separate files, each with its own scope and exports.
You can export and import functionality between modules using the export
and import
keywords. Example:
export function greet(name) {
console.log("Hello, " + name + "!");
}
import { greet } from "./moduleA.js";
greet("John"); // Output: "Hello, John!"