Closed Bug 1235663 Opened 8 years ago Closed 8 years ago

Example uses incorrect function name

Categories

(Developer Documentation Graveyard :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: m.sakrejda, Unassigned)

References

()

Details

:: 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
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.