निम्नलिखित जावास्क्रिप्ट कोड का आउटपुट क्या होगा?
What will be the output of the following JavaScript code ?
<p id="demo"></p>
<script>
var js = 10;
js *= 5;
document.getElementById("demo").innerHTML = js;
</script>
A
10
B
15
C
5
D
50
Explanation
In the given JavaScript code:
var js = 10;
js *= 5;
document.getElementById("demo").innerHTML = js;
- Initially, the value of
jsis10. - The expression
js *= 5;is equivalent tojs = js * 5;, so it multipliesjsby5, changing its value to50. - The updated value of
js, which is50, will then be displayed inside theelement with the id "demo".
So, the correct answer is:
(D) 50.
Correct Answer: D) 50