Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: 'constructor' implies use of new keyword
the square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.
  • Loading branch information
CameronMoorehead authored Nov 28, 2017
commit 96c9f1dd88234602ebc83f9a7e21510f15b8a087
2 changes: 1 addition & 1 deletion doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Below, `bar.js` makes use of the `square` module, which exports a constructor:

```js
const square = require('./square.js');
const mySquare = square(2);
const mySquare = new square(2);
console.log(`The area of my square is ${mySquare.area()}`);
```

Expand Down