forked from jsmapr1/simplifying-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfull.js
More file actions
58 lines (53 loc) · 995 Bytes
/
full.js
File metadata and controls
58 lines (53 loc) · 995 Bytes
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
/* eslint-disable no-unused-vars */
// START:team
const team = [
'Michelle B',
'Dave L',
'Dave C',
'Courtney B',
'Davina M',
];
// END:team
function getDaveVariants(team) {
// START:filter
const daves = [];
for (let i = 0; i < team.length; i++) {
if (team[i].match(/Da/)) {
daves.push(team[i]);
}
}
// END:filter
return daves;
}
// START:instructors
const instructors = [
{
name: 'Jim',
libraries: ['MERIT'],
},
{
name: 'Sarah',
libraries: ['Memorial', 'SLIS'],
},
{
name: 'Eliot',
libraries: ['College Library'],
},
];
// END:instructors
function findMemorialInstructor(instructors) {
// START:findInstructor
let memorialInstructor;
for (let i = 0; i < instructors.length; i++) {
if (instructors[i].libraries.includes('Memorial')) {
memorialInstructor = instructors[i];
break;
}
}
// END:findInstructor
return memorialInstructor;
}
export {
getDaveVariants,
findMemorialInstructor,
};