diff --git a/doc/api/process.md b/doc/api/process.md index 7b74080352c6f1..4ea0fd864e5ecb 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -821,11 +821,10 @@ so, it is recommended to place the `emitWarning()` behind a simple boolean flag as illustrated in the example below: ```js -var warned = false; function emitMyWarning() { - if (!warned) { + if (!emitMyWarning.warned) { + emitMyWarning.warned = true; process.emitWarning('Only warn once!'); - warned = true; } } emitMyWarning();