-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.js
57 lines (38 loc) · 884 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//syntax
/* function name(arguments){
operations or relations
}
calling a function
name(argument_value)
*/
//function01
function callmyname(){
console.log("satyam")
console.log("Javascript")
}
callmyname() //calling a function
// function02 - Making functions dynamic with arguments
function callmyname2(name){
console.log(name)
}
callmyname2("javascript")
//function 03 --- Introduction to Template literals
function greetings(name){
//greet = "hi" + name + "nice to meet you"
//or you can do the same with template literals
greet = `Hi ${name}, Nice to meet you!`
console.log(greet)
}
greetings("satyam")
//function 04
function sum(a,b) {
return a + b
}
console.log(sum(2,4))
num1 = sum(6,7)
console.log(num1)
// ARROW FUNCTION WITH EXPLICIT RETURN
const sumArrow2 = (a,b) => {
return a + b
}
console.log(sumArrow2(5,7))