Write a function called logger
that takes an argument and logs it out using
console.log
.
Write a function called addThree
that adds 3
to any number.
Write a function called sum
that takes two numbers as arguments and
returns the result.
Make a new sumB
function that takes three arguments: two numbers to add,
and a third: a "callback" function. In your sum
function, add the two
numbers and call the callback
with the result.
Make a third sum function: sumC
. It should take three arguments, just
like sumB
. If there is a callback
, the function should call it with the
result. But if the callback
argument is undefined, it should return the
value instead.
Using your sumC
function, add 1
and 2
. Then write a callback to take
the result and add three to it using your addThree
function.
Write a function that waits 2 seconds and then logs out its argument.
Write a function that waits 2 seconds and then calls a callback with the first argument
Write a function that takes a number as an argument. Use it to wait two
seconds then add three to the number using your addThree
function.
Write a function that takes two arguments: a number and a callback.
After two seconds, add five to the number using your sumB
function.
Call the function's callback with the result.
Now, use logger
to log out the result of the previous function.