1

Here is my Javascript code on VS Code:

const name var name

In the console.log(name variable); the name variable is displayed with a strikethrough symbol on VS Code. But the result showing on my browser is right (no error).

Also, the tooltip shown on VS Code is "const name : void".

The same thing is happening if I use

document.getElementById('demo10').innerHTML = name;

or

document.write(name);
var name = 'Smith';
document.getElementById('demo10').innerHTML = name;
console.log(name);
Gino Mempin
  • 19,150
  • 23
  • 79
  • 104

2 Answers2

1

Short Answer:

name is an obsolete property of the Window object. When you see a strikethrough on a variable, VS Code knows that it is deprecated.

Long Answer:

What is the name keyword in JavaScript?

Gino Mempin
  • 19,150
  • 23
  • 79
  • 104
-1

Better update the version of vs code in the new one there is more shortcuts and no annoying errors. thanks

Nahom
  • 34
  • 4