Interview Preparation System Design Interview Objective
May 10, 2013

What is the output of following JavaScript code?
<script type="text/javascript">
function sum(x)
{
function add(y)
{
return x+y;
}
return add;
}
function callme()
{
result=sum(4)(5);
alert(result);
}
</script>
If you call the function callme(), what will happen?

Choose the correct answer:
A) 9
B) 6
C) 45
D) 20
Detailed Explanation

Option  A is the right Answer

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback