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.
32 lines
938 B
32 lines
938 B
4 years ago
|
## Dr Strange
|
||
5 years ago
|
|
||
|
### 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 that can make this happen.
|
||
|
So now, a week is 14 days from `Monday` to `Sunday` then `secondMonday` to `secondSunday`.
|
||
|
|
||
|
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.
|
||
|
|
||
5 years ago
|
|
||
5 years ago
|
### Example
|
||
|
|
||
|
```js
|
||
5 years ago
|
timeTravel({ date, hour, minute, second })
|
||
|
|
||
|
timeTravel({
|
||
|
date: new Date('2020-05-29 23:25:22'),
|
||
|
hour: 21,
|
||
|
minute: 22,
|
||
|
second: 22,
|
||
|
})
|
||
5 years ago
|
|
||
5 years ago
|
// Output: Date { 2020-05-29T21:22:22.000Z }
|
||
5 years ago
|
```
|