In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the indispensable function in the working system of JavaScript". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the indispensable functions in the JavaScript working system?"
I. the concept of function
In daily life, if we want to accomplish a thing, we are always used to having a plan first, and then we can accomplish it and achieve certain results and functions if we follow the plan and implement it step by step. In the programming world, "function" can be called "function", so "function" is a piece of code that implements a function and can be called by other code.
In JavaScript, functions are event-driven, or reusable blocks of code that execute when they are called.
For more information about how JavaScript works, please refer to "how javascript works".
For example:
Second, JavaScript function syntax
In JavaScript, a function is a named block of code decorated with the keyword "function". The format is as follows
Compare the previous example to find out the ingredients; define your own method, pop up a display box, and display your name.
Tip: JavaScript is case sensitive. The keyword function must be lowercase.
Third, define functions with parameters
When we execute a method and need to provide some external data as raw materials, we need to give a name (formal parameter) as the identification of the parameter when the method is defined, and the data can be used by name in the method body. During the call, the data (arguments) are passed in as needed, and the actual data is used according to the passed location during the execution of the method.
Formal parameter: the data passed in when the method is defined is just a name. You can use the name in the method body.
Argument: the angry data when the method is called, the real data, that is, the data that is manipulated when the method is executed.
Tip: no matter whether it is a formal parameter or an actual parameter, there can be any number of parameters. If there are multiple parameters, the parameters are divided by ",", and there is no "," after the last parameter.
4. Functions with return values
When we need to get a result after some method has been executed, the method should have a return value. Use the "return" keyword in the method body to send the final result.
Tip: when there is a "return" statement in the method body and data is returned, variables can be used to receive the results in the calling method; when there is no "return" statement in the method body, variables cannot be used to receive the results in the method call.
At this point, I believe you have a deeper understanding of "what is the indispensable function in the working system of JavaScript". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.