jquery functions: 1. A function is a code block, and the content is included in the function. Some common and practical functions are usually written into functions to facilitate future calls; 2. Functions are also object-oriented. An abstract object, usually with some customized functions.
jquery functions:
There are many different ways to understand functions in javascript. Functions are similar to ours I have learned mathematical functions before, but in programming, I understand them in the following way;
Understanding of functions:
A function is a code block, and the content is contained within the function , usually we write some commonly used and practical functions into functions, and then call them conveniently later.
Function is also an abstract object in object-oriented. Usually we will customize some functions. Functions can also perform assignments and operations. It is not difficult to understand that everyone has used software such as WPS. You will find that functions are used in sums and products. The same is true here. It is not anything special. To complete an event, you need to use something called a function to help it perform operations or process some things.
Define function:
ex:
function Myfirst(){//code};
//Generally we will capitalize the first letter to distinguish it from other ordinary functions.
var timer = setInterval(function (){//code});
Function constants:
ex:
var f = function (a,b){return a+b;};
//First assign the function as a value to f, all the characteristics of the f script function;
alert(f(2,4));
//Then call f to perform data processing on the new internal value, and then pop up the result equal to 6;
The function has one variable and multiple variables, and the functions can also be nested in each other, and the inside of the function remains the same There can be functions. However, nested functions only have permission to be used within the function, so multiplexing and nesting are not used in general use. For developing web pages, completing event binding and handling some simple things, there is no need to do too much processing, but it will be used more when developing plug-ins and encapsulating plug-ins.
The above is the detailed content of What is a function in jquery. For more information, please follow other related articles on the PHP Chinese website!