title: Difference between Number() and toUpperCase() functions
body: <p>Number() and toUpperCase() both look like functions but they can't be written in the same way.  I must be missing an obvious concept but I don't know what it is.</p>
  
  <p>For example the following code works perfect.</p>
  
  <pre><code>var a = "cat";
  var b = "dog";
  console.log(a.toUpperCase() + b.toUpperCase());
  </code></pre>
  
  <p>The result is CATDOG.</p>
  
  <p>But this code throws an error.</p>
  
  <pre><code>var a = 5;
  var b = 10;
  console.log(a.Number() + b.Number());
  </code></pre>
  
  <p><code>a.Number is not a function</code></p>
  
  <p>And yet when I google Number() it is listed as a function.</p>
  
  <p><a href="https://www.w3schools.com/jsref/jsref_number.asp" rel="nofollow noreferrer">JavaScript Number() Function</a></p>
  
  <p>Interestingly when I reverse my code it throws an error.</p>
  
  <pre><code>a = "cat";
  b = "dog";
  
  console.log(toUpperCase(a) + toUpperCase(b));
  </code></pre>
  
  <p><code>toUpperCase is not defined</code></p>
  
  <p>Number() reversed also works just fine.</p>
  
  <pre><code>a = 5;
  b = 10;
  
  console.log(Number(a) + Number(b));
  </code></pre>