2023-06-19 17:00:04 +02:00
== Why is this an issue?
Initializing a variable to `undefined` is unnecessary and should be avoided. A variable will automatically be set to `undefined` if you declare it without initialization, so the initialization code is redundant in this case.
[source,javascript]
----
2023-08-01 08:31:36 +02:00
var foo = undefined; // Noncompliant: replace with var foo;
let bar = undefined; // Noncompliant: replace with let foo;
2023-06-19 17:00:04 +02:00
----
== Resources
=== Documentation
2023-10-19 11:46:59 +02:00
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined[``++undefined++``]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let[``++let++``]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var[``++var++``]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Glossary/Hoisting[hoisting]