Possible Duplicate:
Is there a use for function declarations inside functions?
I know that inside function we can declare a function. What is the use of it? Can you please bring a simple example?
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.
There is little value to declaring a function inside a function, unless you intend on defining it later and only having it available to that function- i.e., the function declaration is encapsulated.
But that’s it. In comparison to triggering the Most Vexing Parse, this is an extremely limited benefit at best.