Skip to content

Files

Latest commit

 

History

History
24 lines (18 loc) · 652 Bytes

param-names.md

File metadata and controls

24 lines (18 loc) · 652 Bytes

Pattern: Non-standard Promise constructor parameter names

Issue: -

Description

The Promise constructor follows the RevealingConstructor pattern with standard parameter names resolve and reject. Using different names or incorrect ordering can make code harder to understand and less consistent with the language specification.

Examples

Example of incorrect code:

new Promise(function (reject, resolve) {
  /* ... */
}); // incorrect order
new Promise(function (ok, fail) {
  /* ... */
}); // non-standard parameter names

Example of correct code:

new Promise(function (resolve, reject) {});