2017-10-16 09:07:00 UTC
3. Functions are used for code reuse, information hiding, and composition
4. Functions are used to specify behavior of objects
5. Craft of programming is factoring of a set of requirements into a set of functions and data structures.
7. Function objects are linked to Function.prototype
8. Function.prototype is itself linked to Object.prototype
9. Objects are collections of name/value pairs having a hidden link to a prototype object
10. Objects produced from object literals are linked to Object.prototype
11. Every function is also created with two additional hidden parameters: "the function context" and "the code that implements the function's behavior"
12. Every function object is also created with a prototype property.
13. A prototype property's value is an object with a constructor property whose value is the function
13. This is distinct from the hidden link to the Function.prototype
14. Since functions are objects, they can be used like any other value
15. That's why function can be stored in variables, objects and arrays. They can be passed as arguments to functions, and functions can be returned from functions, also since they are objects, they can have methods.
16. A function literal can appear anywhere an expression can appear, they can be defined inside of other functions.
17. In the nesting above, an inner function has access to its own parameters and variables as well as that of outer function it s nested within
18. Closure : As indicated in the point #11 , function objects created by a function literal contains a hidden link to that outer context, this is called closure.
19. Functions can be invoked using four invocation patterns: "Method invocation", "Function Invocation", "Constructor invocation" and "Apply Invocation".
(The patterns will be summarized in another blog)
Owned & Maintained by Saurav Prakash
If you like what you see, you can help me cover server costs or buy me a cup of coffee though donation :)