title: Difficulty recognizing data type at validation time
body: <p>I want to validate, but when I enter a number or a string in any case, the data type shows me a string and I can not validate correctly, please help me</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>    function Validator() {
          const x = document.getElementById("fname").value;
          const a = typeof x === "string" &amp;&amp; x.length &gt;= 1;
           console.log(typeof x);
          if (a) {
              console.log("type string");
          } else {
              console.log("other type");
          };
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  &lt;input id="fname"&gt;
    &lt;input type="submit" onclick="Validator()"&gt;</code></pre>
  </div>
  </div>
  </p>