Home > Web Front-end > JS Tutorial > body text

js Function type_javascript skills

WBOY
Release: 2016-05-16 17:58:41
Original
952 people have browsed it

1. A function is an object, and the function name is a pointer to the function object and will not be bound to a function.
2. The function is not overloaded (function overloading: the same function name corresponds to the implementation of multiple functions.)
For Example:
 function addnum(num){return num 10}
 function addnum(num){return num 20}
addnum(10);//30
3. Function expression and function declaration (the parser will read the function declaration first, other situations are equivalent).
4. As a function of value.
Sort the object array according to an object attribute?

Copy the code The code is as follows:

function compareFunction(properyName){
return function(obj1,obj2){
var value1 = obj1[propertyName];
var value2 = obj2[propertyName];
if(value1>value2) {
return 1;
}else if{value1return -1;
else{
>var data = [{name : "Jin",age : 24},{name: "awei",25}];
data.sort(compareFunction("name"));
data[0] .name;


5. Function’s internal attributes (arguments(callee), this);
6. Function’s attributes and methods.
Attributes: length, prototype
Methods: apply(), call()
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!