title: i am trying to print calling function in javascript code but at the same time i am getting undefined.here is the code
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;script&gt;
  
  function myFunction() 
  {
  
   document.write("calling function")
     }
   document.getElementById('demo').innerHTML=myFunction();
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>function myFunction() { document.write("calling function") } document.getElementById('demo').innerHTML=myFunction();</p>