+ 1

In JavaScript, its valid to set a variable to the keyword "undefined", but it is recommended that one never does this. Why❓

JavaScript... Under the hood

29th Jun 2019, 1:25 PM
Keiseon Hamilton
Keiseon Hamilton - avatar
2 Respostas
+ 3
It's redundant. A variable without value is undefined by default, so there's no point in setting one.
29th Jun 2019, 5:05 PM
khangnd
khangnd - avatar
+ 2
That makes sense, it's also important to note that leaving JavaScript to use that keyboard to describe one's undefined variables is crucial when debugging one's code. So yes it is definitely redundant lol, even though it is possible to set a variable as being undefined one should never do that, because that would make debugging a bit difficult. 😸
30th Jun 2019, 3:12 PM
Keiseon Hamilton
Keiseon Hamilton - avatar