-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.js
83 lines (59 loc) · 1.48 KB
/
functions.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
// Basic JavaScript Function :: Function Declaration
function startFan() {
console.log("Stand up");
console.log("Walk towards the switch");
console.log("Press the switch");
}
// startFan(); // Basic JavaScript Function :: Function Calling/Function Invocation
// Output ||
// Stand up
// Walk towards the switch
// Press the switch
*/
/*
// JavaScript Function with Single Parameter
function bringSingara(money) {
console.log("You given:", money);
console.log("Receive your Singara");
}
// bringSingara(100);
// Output ||
// You given: 100
// Receive your Singara
// We can also call a variable as Parameter inside a Function
var taka = 300;
// bringSingara(taka);
// Output ||
// You given: 300
// Receive your Singara
*/
/*
// JavaScript Function with Multiple Parameters
function add(num1, num2) {
console.log("Going to add:", num1, num2);
}
// add(); // Output || Going to add: undefined undefined
// add(25); // Output || Going to add: 25 undefined
// add(125, 96); // Output || Going to add: 125 96
*/
/*
// JavaScript Function with Multiple Parameters :: Addition
function sum(a, b, c, d, e) {
console.log(a, b, c, d, e);
var sum = a + b + c + d + e;
console.log(sum);
}
sum();
// Output ||
// undefined undefined undefined undefined undefined
// NaN <=== NaN : Not a Number
sum(15, 98, 56);
// Output ||
// 15 98 56 undefined undefined
// NaN
sum(15, 98, 56, 5, 9);
// Output ||
// 15 98 56 5 9
// 183
*/