-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJS_022_JS Functions with Parameters.html
43 lines (37 loc) · 1.26 KB
/
JS_022_JS Functions with Parameters.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!--
The Javascript Function Parameters are the names that are defined in the function definition and real values passed to the function in the function definition are known as arguments.
Syntax:
function Name(paramet1, paramet2, paramet3,...)
{
Statements
}
Parameter Rules:
There is no need to specify the data type for parameters in JavaScript function definitions.
It does not perform type-checking based on the passed-in JavaScript functions.
It does not check the number of received arguments.
Parameters:
Name: It is used to specify the name of the function.
Arguments: It is provided in the argument field of the function.
Default Parameter:
The default parameters are used to initialize the named parameters with default values in case, when no value or undefined is passed.
Syntax:
function Name(paramet1 = value1, paramet2 = value2 .. .)
{
statements
} -->
<!DOCTYPE html>
<html>
<head>
<title>JavaScript</title>
<script>
/* Functions With Parameters*/
function hello(fname= "zack",lname= "Yatti") {
document.write("Hello" + fname + " " + lname + "<br>");
}
hello(" ronald","ingh");
hello(" alman", "han");
</script>
</head>
<body>
</body>
</html>