In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use the JavaScript function, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
JavaScript function
Function provides a rich and convenient ability for programmers. Usually when a complex program is designed, the program is divided into some relatively independent parts according to the function to be completed, and each part is written with a function. Thus, each part is fully independent, the task is single, the program is clear, easy to understand, easy to read and easy to maintain. The JavaScript function can encapsulate modules that may be used many times in the program. A program that can be called as an event-driven result. To implement a function to associate it with an event driver. This is different from other languages.
1. JavaScript function definition
Function function name (argument, argument)
{
Function body;.
Return expression
}
Description: when calling a function, the variable or literal quantity used can be passed as a variable. Function is defined by the keyword Function
Definition. Function name: defines the name of your own function. Parameter table, which is passed to the function for use or operation
Value, which can be a constant, a variable, or other expression. Call a by specifying a function name (argument)
A function. The value must be returned using Return. Function names are case-sensitive.
2. Formal parameters in the function:
In the definition of the function, we see that there is a parameter table after the function name, and these parameter variables may be one or more. So how can we determine the number of parameter variables? You can check the number of parameters through arguments. Length in JavaScript. Example:
Function function_Name (exp1,exp2,exp3,exp4)
Number = function _ Name. Arguments .length
If (Number > 1)
Document.wrile (exp2)
If (Number > 2)
[xss_clean] (exp3)
If (Number > 3)
[xss_clean] (exp4); these are all the contents of the article "how to use the JavaScript function". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.