Question discussion

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

287863Medium 1 reply 2,053 views
26
Consider the following code snippet :var tensquared = (function(x) {return x*x;}(10));Will the above code work ?
  • AYes, perfectly
  • BError
  • CException will be thrown
  • DMemory leak
Correct answer: A

Discussion 1

0
CCommunity
Yes, perfectly

Function name is optional for functions defined as expressions. Function expressions are sometimes defined and immediately invoked.