0 votes
in JavaScript by

Which one of the following options is the correct output for the given code of JavaScript?

functionfun()  

{  

var a=1;  

var b=2;  

return a*b;  

}  

document.write(fun());  

a) 2

b) 3

c) 0

d) Error

1 Answer

0 votes
by

Answer: A

Reason: In JavaScript, document.write () is a predefined method which is used for printing output to the console. Here another function in the document.write () method is passed as an argument that returns the multiplication of variables a and b.

...