निम्नलिखित जावास्क्रिप्ट कोड का आउटपुट क्या होगा?
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)
B)
C)
D)
Explanation:
In the given JavaScript code:
var js = 10;
js *= 5;
document.getElementById("demo").innerHTML = js;
- Initially, the value of
js
is10
. - The expression
js *= 5;
is equivalent tojs = js * 5;
, so it multipliesjs
by5
, 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.