title: Why does 'valueAsNumber' return NaN as a value?
body: <p>In the code below, I am trying to call <code>valueAsNumber</code> but I just get a NaN returned. When I use <code>parseInt</code> I get the result I expect. Why Is this?</p>
  
  <pre><code>&lt;html&gt;                                                                                                                                                                                                     
  &lt;head&gt;                                                                                                                                                                                                     
  &lt;title&gt;JavaScript: Demo 1&lt;/title&gt;                                                                                                                                                                          
  &lt;link rel="stylesheet" type="text/css" href="index.css"&gt;                                                                                                                                                   
  &lt;/head&gt;                                                                                                                                                                                                    
  
  &lt;body&gt;                                                                                                                                                                                                     
  &lt;div id="numbers"&gt;                                                                                                                                                                                         
    &lt;div id="inputs"&gt;                                                                                                                                                                                        
      &lt;form name="inputForm"&gt;                                                                                                                                                                                
      &lt;div class="prompt"&gt;Number 1: &lt;input name="number1" type="text"&gt;&lt;/div&gt;                                                                                                                                 
      &lt;div class="prompt"&gt;Number 2: &lt;input name="number2" type="text"&gt;&lt;/div&gt;                                                                                                                                 
      &lt;/form&gt;                                                                                                                                                                                                
    &lt;/div&gt;                                                                                                                                                                                                   
    &lt;div id="result"&gt;                                                                                                                                                                                        
      &lt;div class="prompt"&gt;RESULT: &lt;span id="operation_result"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;                                                                                                                            
    &lt;/div&gt;                                                                                                                                                                                                   
  &lt;/div&gt;                                                                                                                                                                                                     
  &lt;div id="operations"&gt;                                                                                                                                                                                      
  &lt;p&gt;&lt;a id="add_link" href="#" onClick="add(this)"&gt;ADD&lt;/a&gt;&lt;/p&gt;                                                                                                                                               
  &lt;/div&gt;                                                                                                                                                                                                     
  
  &lt;script type="text/javascript"&gt;                                                                                                                                                                            
    function add(linkElement){                                                                                                                                                                               
    // var value1 = parseInt(document.inputForm.number1.value);
    // var value2 = parseInt(document.inputForm.number2.value);
  
    var value1 = document.inputForm.number1.valueAsNumber;
    var value2 = document.inputForm.number2.valueAsNumber;                                                                                                                                              
      var result = value1 + value1;                                                                                                                                                                          
  
      document.getElementById('operation_result').innerHTML = result;                                                                                                                                        
    }                                                                                                                                                                                                        
  &lt;/script&gt;                                                                                                                                                                                                  
  
  &lt;/body&gt;                                                                                                                                                                                                    
  &lt;/html&gt;                                                                                                                                                                                                    
  </code></pre>