title: How to sum 2 number value in javascript
body: <p>in this code snippet i want to sum 2 value that is inserted into prpmpts(values that are numbers other wise alert wrong input). but my problem is when i even insert numbers it alert wrong input and not sum values</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 sumation(a,b){
  if (typeof a == "number" &amp;&amp; typeof b == "number")
  return (a + b);
  else
  alert("wrong input")
  }
  
  window.onload = function(){
    var val1 = prompt("insert first number","");
    var val2 = prompt("insert second number","");
    var result = sumation(val1,val2);
    alert(result);
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;!--
  To change this license header, choose License Headers in Project Properties.
  To change this template file, choose Tools | Templates
  and open the template in the editor.
  --&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;TODO supply a title&lt;/title&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          
      &lt;/head&gt;
      &lt;body&gt;
          &lt;script src="newjavascript.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>