-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.js
36 lines (27 loc) · 906 Bytes
/
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
// ALL about functions
// The bellow sayaHello is a fucntion decleration
let sayHello = function(para) {
console.log(".......Getting from user");
console.log(`Hey ${para}!!!\n`); // para means parameter
}
//calling functions
sayHello('John');
// ---------- 2ND FUNCTION -------------
let fullNameMaker = function(fName , lName) {
console.log('Welcome to our code ...');
console.log(`Happy to have you, ${fName} ${lName}!!!`);
}
fullNameMaker('John' , 'Cena');
// ----------- 3RD FUNCTION in int or float ---------------
let sumVal = function(num1 , num2){
let added = num1 + num2;
console.log(`Hey The sum is ${added} .`);
// or
return added;
}
// if you wanna return this you should have to print(I mean console.log) the returned item.
sumVal(3,5.9);
console.log(sumVal(2,3.6));
// you can store it into a variable too like...
let result= sumVal(2,5);
console.log(result);