Example uses incorrect function name

RESOLVED FIXED

Status

Developer Documentation
JavaScript
P5
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: Maciek Sakrejda, Unassigned)

Tracking

Details

(URL)

(Reporter)

Description

2 years ago
:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

The documentation for the `default` option of `export` uses an internally inconsistent example:

the setup of the export is

```
// module "my-module.js"
let cube = function cube(x) {
  return x * x * x;
}
export default cube;
```

but the import is

```
// module "my-module.js"
import myFunction from 'my-module';
console.log(myFunction(3)); // 27
```

which doesn't use the `cube` function at all. Shouldn't this second one be using `cube` instead of `myFunction`?
This is to illustrate the default export behavior and therefore it can be "myFunction", but I adjusted the example a bit to be less confusing.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.