title: Adding Prompt() to High/Low Game
body: <p>I created a high/low game that goes from 1-20. To take it a step further, I'm attempting to have the user pick the number to play against: pick between 1 - x (user input number). There are other parameters within the game that need to be tweaked as well with that change. I want to use specifically Prompt() for the user to select a number to play against, I'm just not sure how to add it as well as other changes that will need to be made. Any tips are appreciated!</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> var answer = Math.floor(Math.random()*20) + 1;  
      var no_of_guesses = 0;  
      var guesses_num = [];
      function guessing(){  
      var user_guess = document.getElementById("guess").value; 
      if(user_guess &lt; 1 || user_guess &gt; 20 ){  
      alert("That number is not in range, try again!");
      }
      else{  
      guesses_num.push(user_guess);   
      no_of_guesses+= 1;  
      if(user_guess &lt; answer){  
      outcome1.textContent = "Too low"  
      outcome2.textContent = "Number Of Guesses : " +  
      no_of_guesses;  
      outcome3.textContent = "Guessed Number Are: " +  
      guesses_num;  
      }  
      else if(user_guess &gt; answer){  
        outcome1.textContent = "Too High"  
        outcome2.textContent = "No. Of Guesses : " +  
        no_of_guesses;  
        outcome3.textContent = "Guessed Number Are: " +  
        guesses_num;  
      }  
      else if(user_guess == answer){  
        outcome1.textContent = "You're Correct!!"  
        outcome2.textContent = "the Number was " + answer  
        outcome3.textContent = " You guessed it in " +  no_of_guesses  +"Guesses";   
        }  
       }  
      }  
      var outcome1 = document.getElementById("outcome1")  
      var outcome2 = document.getElementById("outcome2")  
      var outcome3 = document.getElementById("outcome3")  </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;div class="container"&gt;  
         &lt;h3&gt;Guess between 1-20!&lt;/h3&gt; 
            &lt;input type="text" placeholder="Choose a number" id="picknum"&gt;&lt;br&gt;
            &lt;button onclick="guessing()" id="my_btn"&gt;GUESS&lt;/button&gt;
            &lt;input type="text" placeholder="Guess a number in range" id="guess"&gt;&lt;br&gt;  
            &lt;p id="outcome1"&gt;Are you feeling lucky?&lt;/p&gt;  
            &lt;p id="outcome2"&gt;&lt;/p&gt;  
            &lt;p id="outcome3"&gt;&lt;/p&gt;
    &lt;/div&gt;  
  
     </code></pre>
  </div>
  </div>
  </p>