JavaScript has 2 scopes, local and global. Local Scope is the every function's scope. If you have 2 variables with the same names which one is in the funciton's scope, it will first access to it's scope. So in your example the outer myGreeter is hidden for the function.Any variable that is defined as var works with hoisting. So your code translates into this one
var myGreeting="Hello";
function callMe(){
var myGreeting; // which is undefind
console.log(myGreeting); // undefined
myGreeting = "HI";
console.log(myGreeting); // HI
}
In which every variables with var keyword and functions declaration are moved to the top of the function.
For more see here
https://www.sitepoint.com/demystifying-javascript-variable-scope-hoisting/
callMefunction, are you? No logs...running the snippet.