title: Javascript. Number('123') doesn't convert a string to number
body: <p>I've encountered some problems during coding.
  I need to convert string like '123' or &quot;123&quot; to number.
  I wrote</p>
  <pre><code>const checkAge_4 = function (age_1) {
  age_1 = prompt('Please enter your age');
  alert(age_1);
  age_1 = Number(age_1);
  alert(age_1);
  let typeof_age_1 = typeof(age_1);
  alert(typeof_age_1);
  if (typeof_age_1 != &quot;number&quot;) {
  alert(`Please enter a number.`)
  }
  else {
      let age_2 = 18;
      let age_3 = 60;
      if (age_1 &lt; age_2) {
          alert(`You don't have access 'cause your age is ${age_1}. It's less than 18.`)
          }
      else if (age_1 &gt;= age_2 &amp;&amp; age_1 &lt; age_3) {
          alert(`Welcome!`)
          }
      else if (age_1 &gt; age_3) {
          alert('Keep calm and watch Culture channel.')
          }
      else {
          alert('Technical work.')
          }
      }
  }
  </code></pre>
  <p>And tried to do it another way using parseInt:</p>
  <pre><code>const checkAge_4 = function (age_1) {
  age_1 = prompt('Please enter your age');
  alert(age_1);
  age_1 = parseInt(age_1);
  alert(age_1);
  let typeof_age_1 = typeof(age_1);
  alert(typeof_age_1);
  </code></pre>
  <p>I added alert because I can't understand why string '123' or &quot;123&quot; doesn't become actual number.
  By the way the 1st alert shows &quot;123&quot;.
  The 2nd alert shows NaN.
  The 3rd alert shows number.
  But later in if/else construction I always get 'Technical work'.
  Please help me to clarify that.
  Thanks in advance.</p>
  <p>I reproduced it in console <a href="https://jsbin.com/bazizepuwe/1/edit?js,console" rel="nofollow noreferrer">https://jsbin.com/bazizepuwe/1/edit?js,console</a></p>
  <p>At the end of the day I get number but it is not being processed like a number. Am I right? Weird situation.</p>