title: Input value with a min and max number
body: <p>Below is an input number form and with JavaScript, I have added some line of codes with the minimum number that can be written is 1 and the maximum number to be written would be 50. 
  And when someone would try to type any number less than 1 and greater than 50 it would automatically replace it with number 1 or 50 but I'm not having success achieving this and I need your help.</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>    document.getElementById('info1').addEventListener("input", function () {
      let num = +this.value, max = 50, min = 1;
      if (num &gt; max || num &lt; min) {
          return false;
        }
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="number" id="info1" size="4"&gt;</code></pre>
  </div>
  </div>
  </p>