This repository was archived by the owner on May 14, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,18 @@ const maartjesTasks = monday.concat(tuesday);
46
46
const maartjesHourlyRate = 20 ;
47
47
48
48
function computeEarnings ( tasks , hourlyRate ) {
49
- // Replace this comment and the next line with your code
50
- console . log ( tasks , hourlyRate ) ;
49
+ return tasks
50
+ . map ( task => task . duration / 60 )
51
+ . filter ( duration => duration >= 2 )
52
+ . reduce ( ( totalBill , durationInHours ) => totalBill + durationInHours * hourlyRate , 0 ) ;
51
53
}
52
54
53
55
// eslint-disable-next-line no-unused-vars
54
56
const earnings = computeEarnings ( maartjesTasks , maartjesHourlyRate ) ;
55
57
56
58
// add code to convert `earnings` to a string rounded to two decimals (euro cents)
57
-
58
- console . log ( `Maartje has earned €${ 'replace this string with the earnings rounded to euro cents' } ` ) ;
59
+ const earningsInString = earnings . toFixed ( 2 ) ;
60
+ console . log ( `Maartje has earned €${ earningsInString } ` ) ;
59
61
60
62
// Do not change or remove anything below this line
61
63
module . exports = {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
function doubleOddNumbers ( numbers ) {
4
- // Replace this comment and the next line with your code
5
- console . log ( numbers ) ;
4
+ return numbers . filter ( number => number % 2 !== 0 ) . map ( number => number * 2 ) ;
6
5
}
7
6
8
7
const myNumbers = [ 1 , 2 , 3 , 4 ] ;
You can’t perform that action at this time.
0 commit comments