JavaScript: What should keyCode be replaced with?

this is the js code:

document.addEventListener('keyup', function (e) {
    if (e.keyCode === 191) {

but in visual studio code says: keyCode is deprecated. What should this code be replaced with? Is there any need to do this at all?


Replace it with e.key === 'Enter' for example or e.code === 'Enter'. You can find more information about it here and here.