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/03 Report--
This article focuses on "the example usage of Function object syntax in JavaScript". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the example usage of Function object syntax in JavaScript".
Function object in JavaScript
The Function object in JavaScript is a function that creates a new one.
The method of use is as follows:
Grammar 1
FunctionfunctionName ([argname1 [,... [, argnameN]) {body}
Grammar 2
Reference:
FunctionName=newFunction ([argname1, [... argnameN,]] body)
Where functionName is a required option. * create the name of the function
Argname1...argnameN is optional. The list of parameters received by the function.
Body is optional. A string containing the block of JScript code that was executed when the function was called.
The basic data type in the function JScript. Syntax 1 creates function values that are converted by JScript to Function objects if necessary. JScript converts a function created with Syntax 2 to a Fnction object when calling a function.
Syntax 1 is the basic method for creating functions in JScript. Syntax 2 is another method for explicitly creating function objects.
For example, to create a function that adds the two parameters passed to it, you can do it in either of two ways:
Example 1
Functionadd (x _ ray) {return (x _ ray); / / performs the addition and returns the result. }
Example 2
Varadd=newFunction ("x", "y", "return (x)")
In both cases, you can call the function with the following line of code:
Add (2pr 3)
When calling a function, be sure to include parentheses and required arguments. Calling a function without parentheses causes the text of the function to be returned instead of the result of the function execution.
At this point, I believe you have a deeper understanding of "the example usage of Function object syntax in 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.