How callMe function works in javascript
<p>I am trying to use <code>callMe</code> in following code. But my output is coming as undefined.if I remove last <code>console.log(myGreeting);</code> from functopn then it printing "Hello" How it works and why its coming <code>undefined.</code></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>var myGreeting="Hello";
function callMe(){
console.log(myGreeting);
var myGreeting = "HI";
console.log(myGreeting);
}</code></pre>
</div>
</div>
</p>