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

प्रोग्राम का आउटपुट दीजिए

Give the output of the program


<html>
<body>
<script>
var number=50;//global variable
function a(){
alert(number);
}
function b(){
alert(number);
}
a();
</script>
</body>
</html>

A
50
B
Error
C
Number
D
None of the above
Explanation

var number = 50; // यह एक global variable है

function a() {
  alert(number); // यह 50 दिखाएगा
}

function b() {
  alert(number); // यह भी 50 दिखाएगा (हालाँकि call नहीं किया गया)
}

a(); // केवल function a() call हुआ है
number एक global variable है और function a() के अंदर इसे सीधे access किया जा सकता है।

function a() को call किया गया है, और वह alert(50) करेगा।

✅ Output: 50

In English:
The global variable number is accessible inside function a().
When a() is called, it alerts 50.

 

 

Correct Answer: A) 50

Latest Updates