Modules allow one to export part of a script to be used by other parts of a program, or by other users, distributed typically through a package manager. The export keyword specifies what to export, and can export function and object definitions or bindings. The import keyword imports what has been opened to use via export. Importing inside { } allows one to import just parts of a module (ex. a couple methods) where importing without { } imports whatever was exported using the default keyword.
Using modules allows a program to better split code into different parts, to avoid the "big ball of mud" issue often seen with poorly structured programs. Modules allow better defined encapsulation and provide specific interfaces via exports. Use of modules in functional programming allows encapsulation and use that would be hard to achieve otherwise.