-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharrow-notation.js
55 lines (36 loc) · 1.04 KB
/
arrow-notation.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
/* arrow notation(()=>{}) */
//always anonymous
//three way syntax:-
/*
1.you can omit the function keyword.
2.if a single parameter then you can omit the parentheses.
3.if single statement then you can omit the curly Braces.
*/
//example
/*
const f1 =function(){
return "hey mumbai"
};
console.log(f1());
//Using Arrow-notation:-
const f2 =()=> "hey mumbai";
console.log(f2());
//Using argument:-
const f3 =function(arg){
return `value of arg:$[arg]`
};
console.log(f3());
//using arrow with argument:-
const f4 =arg=>`value of the arg:$[arg]`;
console.log(f4());
*/
//Using two arguments:-
/*
const f1 =function(arg, arg1){
return arg * arg1;
}
console.log(f1());
//Using two arguments with arrow:-
const f2 =(arg, arg1)=> arg * arg1;
console.log(f2());
*/