I have a situation like this:
console.log(someVar) // <- works, the variable is defined
var somefunction = function () {
    console.log(someVar); 
}
somefunction(); // <- someVar is undefined on the console
I can't demonstrate a simple model showing this because I don't even know how this is possible.  If someVar is defined in the context where someFunction is defined, isn't someVar also in the scope of someFunction?
Are there situations where it is supposed to work like this? If so, I may have stumbled into one accidentally.
 
     
    