foo; // 'undefined' foo(); // this raises a TypeError var foo = function() {}; Due to the fact that var is a declaration, that hoists(=올리다.) the variable name foo before the actual execution of the code starts, foo is already defined when the script gets executed. JavaScript Garden 즉 다음과 같은 코드로 해석된다는 이야기. var foo; foo; // 'undefined' foo(); // this raises a TypeError foo = function() {};