1. The keyword function is always used when creating a new function. When it is followed by a variable name, the new function will be stored under this name. After the name comes a list of argument names and finally the body of the function.
2. A return statement without an expression after it will cause the function to return undefined.
3. Javascript looks up all function definitions, and stores the associated functions, before it starts executing the rest of the program. The nice thing about this is that we do not have to think about the order in which we define and use our functions—they are all allowed to call each other, regardless of which one is defined first.
4. The variables created inside of them are local to the function. This “localness” of variables applies only to the arguments of the function and those variables that are declared with the var keyword inside the function. It is possible to access global (nonlocal) variables inside a function, as long as you haven’t declared a local variable with the same name.
5. Functions defined inside other functions can refer to the local variables in their parent function, functions defined inside those inner functions can refer to variables in both their parent and their grandparent functions, and so on.
6. All variables that were defined “above” a function’s definition are visible, which means both those in function bodies that enclose it and those at the top level of the program. This approach to variable visibility is called lexical scoping.
7. Functions are the only things that create a new scope. A block of code (between braces) doesn’t produce a new local environment. You are allowed to use free-standing blocks.
8. The names of defined functions can be used like normal variables, and their content can be passed around and used in bigger expressions.
9. The “nameless” (or “anonymous”) function expression function(){return "B";} simply creates a function value. It is possible to specify arguments or multi-statement bodies in such definitions as well.
10. Javascript preserves the local variable as long as it is in any way reachable. This feature is called closure, and a function that “closes over” some local variables is called a closure.
11. JavaScript is notoriously nonstrict about the amount of arguments you pass to a function. If you pass too many, the extra ones are ignored. If you pass too few, the missing ones get the value undefined.
12.Math.round is a function that rounds a number.
13.The basic rule, which has been repeated by many programmers is to not worry about efficiency until your program is provably too slow. When it is, find out which parts are taking up the most time, and start exchanging elegance for efficiency in those parts.