-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
110 lines (89 loc) · 3.53 KB
/
index.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// ***************************************************************************
// Iteration 1 - `for...of` loop
// ***************************************************************************
const getFirstNames = arr => {
const userFirstNames = [];
for (let user of arr) {
// Your code goes here ...
}
};
getFirstNames(usersArray);
// expected output:
// [ 'Kirby', 'Tracie', 'Kendra', 'Kinney', 'Howard', 'Rachelle', 'Lizzie' ]
// ***************************************************************************
// Iteration 2 - `for...of` loop and ES6 string literals `${}`
// ***************************************************************************
const getFullNames = arr => {
// Your code goes here ...
};
getFullNames(usersArray);
// expected output:
// [ 'Kirby Doyle', 'Tracie May', 'Kendra Hines', 'Kinney Howard',
// 'Howard Gilmore', 'Rachelle Schneider', 'Lizzie Alford' ]
// ***************************************************************************
// Iteration 3 - ES6 destructuring , for of loop, object literal
// ***************************************************************************
const getUsersCreditDetails = arr => {
// Your code goes here ...
};
getUsersCreditDetails(usersArray);
// expected output:
// [ { firstName: 'Kirby', lastName: 'Doyle', balance: '$3,570.06' },
// { firstName: 'Tracie', lastName: 'May', balance: '$1,547.73' },
// { firstName: 'Kendra', lastName: 'Hines', balance: '$12,383.08' },
// { firstName: 'Kinney', lastName: 'Howard', balance: '$3,207.06' },
// { firstName: 'Howard', lastName: 'Gilmore', balance: '$21,307.75' },
// { firstName: 'Rachelle', lastName: 'Schneider', balance: '$35,121.49' },
// { firstName: 'Lizzie', lastName: 'Alford', balance: '$4,382.94' } ]
// ***************************************************************************
// Iteration 4 - practice `.filter()` method and how to return two elements
// ***************************************************************************
const genderView = users => {
// Your code goes here ...
};
genderView(usersArray);
// expected output:
// {
// femaleUsers: [ 'Tracie May', 'Kendra Hines', 'Rachelle Schneider', 'Lizzie Alford' ],
// maleUsers: [ 'Kirby Doyle', 'Kinney Howard', 'Howard Gilmore' ]
// }
// ***************************************************************************
// Bonus - Iteration 5
// ***************************************************************************
const data = genderView(usersArray);
const genderCount = data => {
// Your code goes here ...
};
genderCount(data);
// expected output:
// Female: 4
// Male: 3
// ***************************************************************************
// Bonus - Iteration 6
// ***************************************************************************
const promo20 = users => {
// Your code goes here ...
};
// expected output:
// Dear Howard, since your balance is $21,307.75, you are eligible to apply for this awesome credit card.
// Dear Rachelle, since your balance is $35,121.49, you are eligible to apply for this awesome credit card.
// ***************************************************************************
// Bonus - Iteration 7
// ***************************************************************************
const addActive = users => {
// Your code goes here ...
};
addActive(usersArray);
// expected output:
// [
// { firstName: 'Kirby',
// lastName: 'Doyle',
// id: 'b71794e5-851e-44b5-9eec-1dd4e897e3b8',
// isActive: true,
// balance: '$3,570.06',
// gender: 'male'
// },
// {
// // ...
// }
// ]