Web technologies Questions | JavaScript Course Quiz 2 | Question 10

What will be the output of the following code?

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


(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

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

About immukul

Executive Software Developer at Cavisson Systems