This article is in need of a technical review.
This article is in need of an editorial review.
Summary
The export statement used to allow a signed script to provide properties, functions, and objects to other signed or unsigned scripts. It is an ancient Netscape 4 feature and has been removed in Firefox 3.5 (bug 447713). In the future, a new export declaration will be specified by ECMAScript 6 modules.
Syntax
export name1, name2, ..., nameN; export *;
-
nameN - Property, function, or object to be exported.
Description
Typically, information in a signed script is available only to scripts signed by the same principals. By exporting properties, functions, or objects, a signed script makes this information available to any script (signed or unsigned). The receiving script uses the companion import statement to access the information.
The first syntax exports the specified properties, functions, and objects.
The second syntax exports all properties, functions, and objects from the script.
Specifications
Prior to ECMAScript Edition 6, no import/export or module functionality has been defined in ECMA-262 standards.
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | Not supported | Not supported (Netscape 4 until Firefox 3.5) |
Not supported | Not supported | Not supported |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |