What is the output of the following JavaScript code? | Question 25

82. What will be the output of the following JavaScript code?

<script>
    let x = 10;
    
    document.write(typeof x, " , ", typeof String(x));
</script>
  1. number , string
  2. number , number
  3. object , string
  4. object , object

Answer: A) number , string

Explanation:

In the above JavaScript code, we are using the String() method which is a global method to convert numbers to string. Thus, the statement typeof String(x) will return string.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.