koderkaran

GTN javascript

Oct 25th, 2020 (edited)
661
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var computer = Math.random () * 3;
  2. computer = Math.floor (computer);
  3. computer = computer + 1;
  4.  
  5. function calculate (player)
  6. {
  7.     if (computer > player)
  8.     {
  9.          document.getElementById ("message").innerHTML = "my number is higher";
  10.     }
  11.  
  12.     if (computer < player)
  13.     {
  14.          document.getElementById ("message").innerHTML = "my number is lower";
  15.     }
  16.  
  17.     if (computer == player)
  18.     {
  19.          document.getElementById ("message").innerHTML = "you got it";
  20.     }
  21.  
  22. }
RAW Paste Data