-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.html
More file actions
52 lines (41 loc) · 1.15 KB
/
Copy pathfunctions.html
File metadata and controls
52 lines (41 loc) · 1.15 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
/*
1.
Function Declaration(FD) and Function Expresson(FE)
FD has hoisting , FE has no hoisting.
FE uses variable assignment ,FD uses function-name
2..
Arrow function
const variable-name=()=>{
}
if only single param , no need of parantheses.
if only single line of code in body no need of flower brackets and no need of return keyword , automatically returns
*/
//3
function add(a,b){
const sum=a+b;
return sum;
}
//4...
const mul=function(a,b){
return a*b;
}
//5..
const sub=(a,b)=>a-b;
//6..
function reverseString(str) {
return str.split('').reverse().join('')
}
console.log(reverseString('junaid'));
</script>
</body>
</html>