Well, I don't think that is the case. we can use undefined as a variable but we should not. And yes we can assign the value to it until and unless it is const. Here is the demo -
This image shows that we can use undefined as a variable name. I have not declared it because browser's console declare it by default to undefined .
If you wish to use it *.js file you can also do that
letundefined=3;// `var` also works fine but not `const`console.log(undefined);// output : 3undefined=9;console.log(undefined);// output : 9
The above example shows that you can use undefined as long as it is not const because const is immutable. Since we are using it as a varible name.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Well, I don't think that is the case. we can use
undefinedas a variable but we should not. And yes we can assign the value to it until and unless it isconst. Here is the demo -This image shows that we can use
undefinedas a variable name. I have not declared it because browser's console declare it by default toundefined.If you wish to use it
*.jsfile you can also do thatThe above example shows that you can use undefined as long as it is not
constbecause const is immutable. Since we are using it as a varible name.