document.addEventListener("keydown", (event) => {
/*
event.key returns the character being pressed
event.preventDefault() prevents the default browser behavior for that shortcut, e.g. ctrl+r usually reloads the page, but event.preventDefault() will turn off that behavior. event.preventDefault() should only be used if you share a shortcut with the same trigger as the browser.
event.ctrlKey / event.altKey / event.shiftKey / event.metaKey all return booleans. They will be true when they are being pressed, otherwise they will be false.
*/
if (event.ctrlKey && event.key.toLowerCase() === "d") {
//Do something
} else if (event.ctrlKey && event.key.toLowerCase() === "p") {
//Do something else
}
});
document.onkeyup = function(e) {
if (e.which == 16) {
alert('You have press Shift')
}
if (e.which == 17 && e.which == 13) {
alert('You have press CTRL + Enter')
}
//Keyboard events codes
//https://www.toptal.com/developers/keycode
};