Home / Programming MCQs / JavaScript MCQs / Question

C

Chandani • 9.73K Points
Tutor III

Q. Will the following JavaScript code work?

Code:
var js = (function(x) {return x*x;}(10));
(A) Exception will be thrown
(B) Memory leak
(C) Error
(D) Yes, perfectly
Explanation by: Chandani
For functions expressed as expressions, the function name is optional in Javascript. Sometimes function expressions are defined and used right away.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.