What is the output of the following JavaScript code? | Question 4

35. What will be the output of the following JavaScript code?

<script>
	var x = 10 + 20 * 5;
	document.getElementById("tes").innerHTML = x;
</script>
  1. 110
  2. 150
  3. TypeError
  4. ValueError

Answer: A) 110

Explanation:

The output of the above statement will be 110.

In the above code, the expression is 10 + 20 * 5. The precedence of multiplication operator (*) is higher than the addition operator (+). This 20 *5 will evaluate first.

Comments and Discussions!

Load comments ↻






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