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>
  1. SyntaxError
  2. ValueError
  3. 0
  4. 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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.