Vidyalelo
JavaScript · Q22

Array And Function

Programming · JavaScript · question 22

Q22

Consider the following code snippet : var tensquared = (function(x) return x*x;(10)); Will the above code work ?

A.
Yes, perfectly
Answer
B.
Error
C.
Exception will be thrown
D.
Memory leak

Answer: Option A

Solution

Answer: Option A
Solution:
Function name is optional for functions defined as expressions. Function expressions are sometimes defined and immediately invoked.