Open In App

Web technologies Questions | JavaScript Course Quiz 2 | Question 10

Last Updated : 18 Apr, 2019
Like Article
Like
Save
Share
Report

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads