V
V
Vika Marmeladka2020-10-28 15:04:06
Visual Studio Code
Vika Marmeladka, 2020-10-28 15:04:06

Why did VS Code cross out the keyCode property?

The code works as intended, there are no errors or warnings from the compiler. So what's the deal?

5f995e0e76f91991186856.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
twobomb, 2020-10-28
@homsi959

Because if you go to https://developer.mozilla.org/ru/docs/Web/API/Docu...
Then opposite the keyCode we will see


Warning: This attribute is deprecated; you should use key instead, if available.

Krch saying use key instead of keyCode if you can
PS But don't care, js will pull this load to ensure compatibility with old code

R
Rsa97, 2020-10-28
@Rsa97

Because this property is deprecated and its use is not recommended.

N
Niker, 2020-10-28
@CyberTopTuK

KeyboardEvent.KeyCode is deprecated. You can use KeyboardEvent.code
https://developer.mozilla.org/en-US/docs/Web/API/K...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question