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-08-01 08:31:36 +02:00
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined[MDN - ``++undefined++``]
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let[MDN - ``++let++``]
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var[MDN - ``++var++``]
* https://developer.mozilla.org/en-US/docs/Glossary/Hoisting[MDN - hoisting]