What is the concept of “functions as objects” and how does this affect variable scope?



What is the concept of “functions as objects” and how does this affect variable scope?..

Answer / Avinash Rai

In JavaScript, functions are objects. This means that they can be created, assigned to variables, passed as arguments to other functions, and returned from other functions. Regarding variable scope, when a function is declared within another function, it has access to the outer function's variables unless they are explicitly re-declared with 'var', 'let', or 'const' in the inner function.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Interview Questions

What is whitespace in javascript?

1 Answers  


Some XYZ company is arranging for online aptitude tests. Draw detailed E-R diagram for the same..

1 Answers   QuinStreet,


How do I open javascript in browser?

1 Answers  


Is there any ide for javascript?

1 Answers  


What is an anonymous function in JavaScript?

1 Answers  


java is pure object oriented or not?

4 Answers  


How to remove duplicates from javascript array?

1 Answers  


What is the difference between registerclientscriptblock and registerstartupscript?

1 Answers  


What is the role of a strict mode in javascript?

1 Answers  


How can I prevent others from reading/stealing my scripts or images?

1 Answers  


What is object cloning

4 Answers  


Is python better than javascript?

1 Answers  


Categories