🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित जावास्क्रिप्ट कोड का आउटपुट क्या है?

What is the output of the following JavaScript code ?

<script>
var a;
document.getElementById("demo").innerHTML = a+1;
</script>

A)
B)
C)
D)

Explanation:

In the given JavaScript code:

var a;
document.getElementById("demo").innerHTML = a + 1;
  • The variable a is declared but not initialized, so its value is undefined.
  • When you try to add undefined to 1, the result will be NaN (Not a Number).

So, the correct answer is:

(D) NaN.

Latest Updates