Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the three ways of declaring functions in JavaScript

Shulou Source: shulou.com Published: 2022-06-01 10:31:45 11月08日 Update

What are the knowledge points of this article "what are the three declaration functions of JavaScript?" most people do not understand, so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what are the three declaration functions of JavaScript?"

Three ways of declaring functions in JavaScript

1. Declarative function

Function functionName (arg1, arg2) {alert (arg1+arg2);}

2. Anonymous function

Var functionName1 = new Function ("arg1", "arg2", "alert (arg1 + arg2)")

3. Direct quantity function

FunctionName2 = function (arg1, arg2) {alert (arg1 + arg2);}

Three methods of function call

FunctionName ("1", "22")

FunctionName1 ("2", "11")

FunctionName2 ("Hello", "World")

Continue to read, you can also write like this, the first experience is very good

FunctionName1.love = "Hello World!"

Alert (functionName1.love)

FunctionName1.Test = function () {alert ("Test");}

FunctionName1.Test ()

The above is the content of this article on "what are the three declaration functions of JavaScript?". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Functions methods content articles knowledge articles good value most of them that is more steps knowledge points first time industry information information channels channels experience help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno vpn Docker Shulou Technology