Implement the function setEasyTimout(func, time)
.
It should execute the function func
after the specific amount of time
.
time
- is an object with hours
, minutes
, seconds
. Examples in solution.js
.
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
functions.js
export const setEasyTimeout = (func, time) => {
func();
}
solution.js
/**
* Implement the function setEasyTimout(func, time)
*
* It should execute the function `func` after the specific amount of `time`.
* */
import { setEasyTimeout } from './functions.js';
const wakeUp = () => {
console.log('Ok... Time to wake up..');
}
const doMorningRoutine = () => {
console.log('Where\'s my toothbrush?');
}
const learnJavascript = () => {
console.log('Learning JS is very exciting!');
}
const goToSleep = () => {
console.log('That was a very productive day... Time to rest..');
}
setEasyTimeout(wakeUp, { hours: 8, minutes: 0, seconds: 0 })
setEasyTimeout(doMorningRoutine, { hours: 8, minutes: 5, seconds: 10 })
setEasyTimeout(learnJavascript, { hours: 8, minutes: 15, seconds: 30 })
setEasyTimeout(goToSleep, { hours: 22, minutes: 10, seconds: 30 })