JavaScript event.keyCode value for delete

Hi, tried adding keyboard events to my app, but the logic isn’t working as expected.

event.keyCode = 46 activates the dot (.) key instead of the Delete key.

Similarly, backspace activates the browser’s Backward behaviour despite using event.preventDefault().

Any better solution?