Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following JavaScript code?
var add=new Function(“num1″,”num2″,”return num1+num2”);
document.writeln(add(2,5));

What will be the output of the following JavaScript code?
var add=new Function(“num1″,”num2″,”return num1+num2”);
document.writeln(add(2,5));
a) 2
b) 5
c) error
d) 7

Answer: d
Explanation: add function is defined in the first line of the code using the new property. Add function returns the sum of the two arguments passed to it.

Join The Discussion