Open In App

Web technologies Questions | JavaScript Course Quiz 2 | Question 10

What will be the output of the following code?




<script>
   var x = [typeof x, typeof y][1];
   document.write(typeof typeof x);
</script>

(A) undefined
(B) string
(C) number
(D) boolean

Answer: (B)
Explanation: typeof ‘y’ which is undefined returns ‘undefined’, typeof ‘undefined’ is ‘string’, and another typeof on it still returns ‘string’.
Quiz of this Question

Article Tags :