Skip to content

Commit 1efcd54

Browse files
committed
commit tree 53d35b0
1 parent 70ea7ac commit 1efcd54

1 file changed

Lines changed: 29 additions & 12 deletions

File tree

index.js

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
1-
// code your solution here
1+
// Code your solution in this file!
2+
let array=['don','jose','mike','tommy']
23

3-
function saturdayFun(msg='roller-skate'){
4-
return `This Saturday, I want to ${msg}!`
5-
};
6-
saturdayFun('bathe my dog');
4+
const returnFirstTwoDrivers=(array)=>array.slice(0,2)
75

8-
function mondayWork(message='go to the office'){
9-
return `This Monday, I will ${message}.`
10-
};
11-
mondayWork('work from home');
126

13-
function wrapAdjective(msg='*'){
14-
return function (txt='special'){
15-
return `You are ${msg}${txt}${msg}!`
7+
8+
const returnLastTwoDrivers=(array)=>array.slice(-2)
9+
10+
returnLastTwoDrivers(array)
11+
12+
const selectingDrivers=[returnFirstTwoDrivers,returnLastTwoDrivers];
13+
14+
function createFareMultiplier(int){
15+
return(function fareMultiplier(fare){
16+
return fare *int;
17+
})
18+
}
19+
const fareDoubler=function(fare){
20+
return (fare *2);
21+
}
22+
23+
const fareTripler =function(fare){
24+
return (fare*3)
25+
}
26+
27+
function selectDifferentDrivers(array,command){
28+
if (command===returnFirstTwoDrivers){
29+
return(returnFirstTwoDrivers(array));
30+
}
31+
else if(command===returnLastTwoDrivers){
32+
return (returnLastTwoDrivers(array));
1633
}
1734
}

0 commit comments

Comments
 (0)