title: When i make use of the getRandomNumber(); it gets a random number on page reload but does not change the random number on button click
body: <p>OnClick of my submit button, the random function is supposed to refresh but mine remains the same. So i tried a different approach and it worked. To get the desired result i wrote my code inside the a playGame function Like this.</p>
  <pre><code>window.onload = function() {
      document.getElementById(&quot;number-submit&quot;).addEventListener(&quot;click&quot;, playGame);
      document.getElementById(&quot;restart-game&quot;).addEventListener(&quot;click&quot;, initGame);
  
  }
  
  function playGame() {
      let numberGuess = document.getElementById(&quot;number-guess&quot;).value;
      console.log(numberGuess);
  
      var randomNumber = Math.floor((Math.random() * 3) + 1);
      console.log(randomNumber);
  
      if (numberGuess &gt; randomNumber) {
          console.log(&quot;Too High, Try Again&quot;);
      } else if (numberGuess &lt; randomNumber) {
          console.log(&quot;Too Low, Try Again&quot;);
      } else {
          console.log(&quot;Congratulations This Is Correct!!&quot;);
      }
  }
  </code></pre>
  <p>i tried writhing a getRandomNumner() function after trying out my solution to see if i could make my code better but using the code provided below does not provide the desired result for me.
  When i make use of the getRandomNumber(); it gets a random number on page reload but does not change the random number on click of the button.
  What are my doing wrong??
  This is my getRandomNumber function.</p>
  <pre><code>let correctNumber = getRandomNumber();
  console.log(correctNumber);
  
  function getRandomNumber(){
  
  let randomNumber = Math.floor((Math.random() * 100) + 1);
  
      return randomNumber;
  }
  </code></pre>
  <p>WHAT ARE MY DOING WRONG WITH THE getRandomNumber() ??</p>