-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrow-function.js
More file actions
65 lines (49 loc) · 1.15 KB
/
Copy patharrow-function.js
File metadata and controls
65 lines (49 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
53
54
55
56
57
58
59
60
61
62
63
64
65
//index.html
function normalFunction()
{
console.log("This is normal function");
}
const arrowFunction=()=>{
console.log("This is arrow function"); //second bracket does not need for one method..
};
let arrowReturnFunction=()=> "This is return function";
let arrowReturnFunction1=(num,num1)=> num+num1;
normalFunction();
arrowFunction();
console.log(arrowReturnFunction());
console.log(arrowReturnFunction1(10,20));
let students=[
{
stdId:101,
stdName:"Rahid",
gpa:2.83
},
{
stdId:102,
stdName:"Amin",
gpa:3.95
}
,
{
stdId:103,
stdName:"Siddique",
gpa:3.30
}
];
function studentName() ///Important
{
return students.filter(function(x)
{
return x.gpa > 3.5;
}).map(function(y)
{
return y.stdName;
})
}
console.log(studentName());
//using arrow function
var studentName1=()=>
{
return students.filter((x)=>x.gpa<3.5).map((y)=>y.stdName);
}
console.log(studentName1());