menu

arrow_back Why did VS Code, cross out the keyCode property?

by
1 vote
The code works as intended, no errors or warnings from the compiler. So what's the problem?

5f995e0e76f91991186856.png

3 Answers

by
 
Best answer
0 votes
Because if you go to https://developer.mozilla.org/ru/docs/Web/API/Docu...
Then in front of the keyCode we will see
Warning: This attribute is deprecated; you should use key instead, if available.
In short, use key instead of keyCode if you can
P.S. Whatever, js will pull this load to ensure compatibility with the old code
by
0 votes
KeyboardEvent.KeyCode is deprecated. You can use KeyboardEvent.code

https://developer.mozilla.org/en-US/docs/Web/API/K...
by
0 votes
Because this property is in a derriere status and its use is not recommended.