Question: undefined 7. a. Create a script with an anonymous function, and assign it to a variable ('foo'). In the function body, display the variable name.
undefined
7. a. Create a script with an anonymous function, and assign it to a variable ('foo'). In the function body, display the variable name. Call the function via the variable. Now add to the script (after the previous function call), a call to the setTimeout library function; pass the variable 'foo' (that points to the anonymous function) and a delay of 5 seconds as parameters to the setTimeout library function. b. Re-factor the 7a so only the setTimeout function is called with two arguments. The first is an anonymous function (defined in the argument list) that has the same functionality as 7a, but displays "Anonymous function: delay 2 seconds." instead of the function name. The second argument is a delay of 2 seconds. Make sure you understand how this mechanism works
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
