1.
How do you assign a function to a variable in JavaScript?
2.
What will be the output of the following code? var sayHi = function() { return "Hi"; }; console.log(sayHi());
3.
How can you pass a function as an argument to another function?
4.
What is the term for a function that is passed as an argument to another function?
5.
What will be the output of the following code? var double = function(x) { return x * 2; }; console.log(double(5));
6.
How do you define an anonymous function assigned to a variable?
7.
Which of the following correctly demonstrates a function returning another function?
8.
What is the output of the following code? function makeAdder(a) { return function(b) { return a + b; }; } var add5 = makeAdder(5); console.log(add5(2));
9.
How can you invoke a function stored in a variable doSomething?
10.
Which of the following is an example of an arrow function assigned to a variable?