console.log(a());
function a(){
console.log("hello");
}
From above code, i will expect "hello" (and some undefineds) to be logged on console. But firebug gives
ReferenceError: a is not defined
So firebug does not do hoisting?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The reason for the issue is that
by MDN (Much covered here is not standard ECMAScript).
Compare the following snippets:
and
The first one will alert 42, whereas the second one will throw
ReferenceError.And here is the code that gets executed when you are playing with Firebug:

Update
The behavior observed seems to be a glitch in Firefox javascript engine because it is not observed in chrome and IE9, see this fiddle.