1. A function is an object, and a function name is a pointer to a function object and is not bound to a function.
2. Functions are not overloaded (function Overload: The same function name corresponds to the implementation of multiple functions.)
For Examle:
function Addnum (num) {return num+10}
function Addnum (num) {return num+20}
Addnum (10);//30
3. function expression and function reputation (the parser takes the lead in reading function declarations, others are equivalent).
4. function as a value.
Sort the array of objects by an object property?
Copy Code code as follows:
function Comparefunction (properyname) {
return function (OBJ1,OBJ2) {
var value1 = Obj1[propertyname];
var value2 = Obj2[propertyname];
if (value1>value2) {
return 1;
}else if{value1<value2}{
return-1;
else{
return 0
}
}
}
var data = [{name: "Jin", Age:24},{name: "Awei", 25}];
Data.sort (comparefunction ("name"));
Data[0].name;
5. Internal properties of the function (arguments (callee), this);
6. Properties and methods of the function.
Attributes: Length, prototype
Methods: Apply (), call ()