JavaScript MCQ : JS Variables (Multiple Choice Questions)


Question 1
Local Variables are Destroyed as soon as ______________.
A
user closes the browser
B
control comes outside the method
C
page gets completely loaded
D
None of these
Question 2
<script type="text/javascript">
    var name;
    name = "Pritesh";
</script>
<script type="text/javascript">
    document.write(name);
</script>
What will be the output of the following ?
A
Pritesh
B
None of these
C
Error
D
Nothing will be printed
Question 2 Explanation: 
Variable is declared outside the method so it is called as Global Variable.
There are 2 questions to complete.