ExtremeGamer1480

JavaScript Reminder

Jun 6th, 2021
971
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function reminder() {
  2.     if (!confirm('Do you want to set a reminder?'))
  3.         return;
  4.     var reason = prompt('What do you want to be reminded?');
  5.     if (reason == null)
  6.         return;
  7.     var hr = prompt('How many hours from now do you want to be reminded?\n\n(Whole numbers only)');
  8.     if (hr == null)
  9.         return;
  10.     if (!Number.isInteger(Number(hr))) {
  11.         alert('Invalid Input!\nPlease type a number!');
  12.         return;
  13.     }
  14.     var min = prompt('How many minutes from now do you want to be reminded?\n\n(Whole numbers only)');
  15.     if (min == null)
  16.         return;
  17.     if (!Number.isInteger(Number(min))) {
  18.         alert('Invalid Input!\nPlease type a number!');
  19.         return;
  20.     }
  21.     var sec = prompt('How many seconds from now do you want to be reminded?\n\n(Whole numbers only)');
  22.     if (sec == null)
  23.         return;
  24.     if (!Number.isInteger(Number(sec))) {
  25.         alert('Invalid Input!\nPlease type a number!');
  26.         return;
  27.     }
  28.     hr *= 60
  29.     hr *= 60
  30.     hr *= 1000
  31.     min *= 60
  32.     min *= 1000
  33.     sec *= 1000
  34.     setTimeout(function() {
  35.         alert('Reminder:\n' + reason);
  36.     }, hr + min + sec);
  37.     alert('Your reminder has been set!');
  38. }
  39. reminder();
RAW Paste Data