Creating an unnamed function 1

Creating an unnamed function

var x = function(y) {
   return y * y;
};

Here is what the above code is Doing:
1. We create a function called x.
2. The function takes in a parameter called y.
3. The function returns the value of y times y.
4. We call the function x and pass in the value 2.
5. The function returns the value 4.

Similar Posts