mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
992 B
33 lines
992 B
4 years ago
|
## Dr Strange
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
You have been given the mission to create a new sense of time.
|
||
|
Instead of a normal week having only 7 days, you will have 14 days.
|
||
|
Your mission is to create an `addWeek` function with one parameter of `Date` type.
|
||
|
So now, a week is 14 days from `Monday` to `Sunday` then `secondMonday` to `secondSunday`.
|
||
|
Week number should be count from `0001-01-01`
|
||
|
|
||
|
Now imagine you have a doctor appointment and you have to wait some hours.
|
||
|
But you do not want to wait, so what you need to do is create a
|
||
|
function `timeTravel` that allows you to change the time according to your needs, this function
|
||
|
it can go backwards or forwards in time.
|
||
|
You will have a function that takes a date and you will pass 3 more parameters to change
|
||
|
the hour, minute and seconds.
|
||
|
|
||
|
|
||
|
### Example
|
||
|
|
||
|
```js
|
||
|
timeTravel({ date, hour, minute, second })
|
||
|
|
||
|
timeTravel({
|
||
|
date: new Date('2020-05-29 23:25:22'),
|
||
|
hour: 21,
|
||
|
minute: 22,
|
||
|
second: 22,
|
||
|
})
|
||
|
|
||
|
// Output: Date { 2020-05-29T21:22:22.000Z }
|
||
|
```
|