Skip to content

Commit 84a5816

Browse files
authored
no-typeof-undefined: Add historical note to docs (#1992)
1 parent 8dff476 commit 84a5816

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/rules/no-typeof-undefined.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
Checking if a value is `undefined` by using `typeof value === 'undefined'` is needlessly verbose. It's generally better to compare against `undefined` directly. The only time `typeof` is needed is when a global variable potentially does not exists, in which case, using `globalThis.value === undefined` may be better.
1111

12+
Historical note: Comparing against `undefined` without `typeof` was frowned upon until ES5. This is no longer a problem since all engines currently in use no longer allow reassigning the `undefined` global.
13+
1214
## Fail
1315

1416
```js

0 commit comments

Comments
 (0)