Advertisement
EconomicSerg

Key Pressed Event

Jan 26th, 2021
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.addEventListener('keydown', (event) => {
  2.     if (event.key === 's' && event.ctrlKey && event.altKey) {
  3.         event.preventDefault();
  4.         var x = prompt("How much money to put in?");
  5.         if (x  >= 100) {
  6.             alert("Wow, you are rich!");
  7.         } else if (x <= 100) {
  8.             alert("Wow, you are broke!");
  9.         } else {
  10.             alert("That is not money!");
  11.         }
  12.     }
  13. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement