title: Why Won't this Output 100%
body: <p>I am trying to make a progress bar, but I am trying to figure out the percentage. I have two textboxes <strong>Make sure to put the larger number in the second</strong> and it will calculate the percentage by dividing</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>$("#btn").click(function () {
    var num1 = $("#textbox1").val();
    var num2 = $("#textbox2").val();
  
    var perectageTotal = (num1 / num2) * 100;
  
    let totalString = perectageTotal.toString().length;
  
    if (totalString &gt; 2) {
      var result = perectageTotal.toString().slice(0, 2);
    } else if ((totalString = 1)) {
      var result = "100";
    } else {
      var result = perectageTotal.toString().slice(0, 4);
    }
    console.log(parseInt(result));
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="textbox1" id="textbox1" placeholder="Enter Number 1" /&gt;
  &lt;input type="textbox2" id="textbox2" placeholder="Enter Number 2" /&gt;
  &lt;input type="button" value="Click Me" id="btn" /&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>them, it works but dividing the same number to get 100% does not work, it only output 10. Why?</p>