Home »
MCQs »
JavaScript MCQs
What is the output of the following JavaScript code? | Question 26
83. What will be the output of the following JavaScript code?
<script>
let x = 10;
document.write(x, " , ", toString(x));
</script>
- 10 , 10
- 10 , undefined
- 10 , [object Undefined]
- None of the above
Answer: C) 10 , [object Undefined]
Explanation:
In the above JavaScript code, the statement toString(x) will not convert number to string because toString() is not a global method, it is a Number method and the correct way is to call this function is x.toString().