Home »
MCQs »
JavaScript MCQs
What is the output of the following JavaScript code? | Question 7
45. What will be the output of the following JavaScript code?
<script>
function addition(a, b) {
return a+b;
}
document.getElementById("test").innerHTML = addition;
</script>
- SyntaxError
- ValueError
- 0
- function addition(a, b) { return a+b; }
Answer: D) function addition(a, b) { return a+b; }
Explanation:
Calling of a function without () will return the function definition i.e., function object instead of the result.