Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

46) What is the output of following JavaScript code? <script type=\"text/javascr

ID: 3542476 • Letter: 4

Question

46) What is the output of following JavaScript code?

<script type="text/javascript">

function x()

{

var cst = "First come, first served";

var pattern = /first/g;

document.write(cst.match(pattern)[1]);

}

</script>

a) first

b) First

c) undefined

d) None of the above

47) 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(5)(5);

alert(result);

}

</script>

If you call the function callme(), what will happen?

a) 10

b) Error in calling Function

c) 5

d) None of the above

Explanation / Answer

c

a

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote