...

/

Exercise on Default Arguments

Exercise on Default Arguments

It's time to play with function arguments.

Exercise 1:

Write a function that executes a callback function after a given delay in milliseconds. The default value of delay is one second.

The setTimeout() method can be used to specify the time delay before a function is executed.

function executeCallback( callback, delay ) {
console.log('Delay: ' + delay);
}
//Edit above this line
executeCallback( () => console.log('Done'));

Explanation:

The main objective of this exercise was to define a default argument for delay.

Using ES6 conventions, we can simply ...