-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (27 loc) · 807 Bytes
/
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
const returnFirstTwoDrivers = function(drivers) {
return drivers.slice(0, 2);
};
const returnLastTwoDrivers = function(drivers) {
return drivers.slice(-2);
};
const selectingDrivers = [returnFirstTwoDrivers, returnLastTwoDrivers];
const createFareMultiplier = function(multiplier) {
return function(value) {
return value * multiplier;
};
};
const fareDoubler = createFareMultiplier(2);
const fareTripler = createFareMultiplier(3);
const selectDifferentDrivers = function(drivers, func) {
return func(drivers);
};
module.exports = {
returnFirstTwoDrivers,
returnLastTwoDrivers,
selectingDrivers,
createFareMultiplier,
fareDoubler,
fareTripler,
selectDifferentDrivers
};
// Code your solution in this file!