title: How to print out line in Javascript
body: <p>I want to test the return value of this function getFileExtension(input.files[0].name)  (I have a comment there to point at that line)
  My question is how to print out that value in javascript? Thanks!</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script&gt;
      function getFileExtension(filename) {
          var ext=filename.split('.').pop();
          return ext
      }
  &lt;/script&gt;
  
  &lt;input type='file' onchange="readURL(this);"&gt; 
  
  &lt;script&gt;
  function readURL(input) {
      if (input.files &amp;&amp; input.files[0]) {
          if (getFileExtension(input.files[0].name)=="png") { // this line is our problem 
              var reader = new FileReader();
              reader.onload = function (e) {
                  document.getElementById("pdf").innerHTML="&lt;img id='blah' src=" +
                                         e.target.result + " alt='your image' width='450'&gt;"
              }
              reader.readAsDataURL(input.files[0]);
          }
      }
  }
  &lt;/script&gt;
  </code></pre>