send short key with javascript code example
Example 1: js shortcut
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && String.fromCharCode(e.keyCode).toLowerCase() === 's') {
e.preventDefault();
e.stopPropagation();
// Do some stuff...
}
}, false);
Example 2: what are some javascript shortcuts
// If you want to write the code x=x+2, you can just go x += 2.
// If you want to write the code x += 1, you can just go x++