JavaScript MCQ : JS Variables (Multiple Choice Questions)
Question 1 |
Local Variables are Destroyed as soon as ______________.
None of these | |
page gets completely loaded | |
control comes outside the method | |
user closes the browser |
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 ?
Nothing will be printed | |
Error | |
Pritesh | |
None of these |
Question 2 Explanation:
Variable is declared outside the method so it is called as Global Variable.
There are 2 questions to complete.