What will be the output of the following JavaScript code? [code] <p id="demo"></p> <script> function myFunction() { var num = 5.56789;

Đức Linh

New member
What will be the output of the following JavaScript code?
Code:
<p id="demo"></p>
<script>
function myFunction() 
{
   var num = 5.56789;
   var n = num.toExponential();
   document.getElementById("demo").innerHTML = n;
}
</script>
A. 5.56789e+0
B. 5.57e+0
C. 5.568e+0
D. Error
 

Tìm kiếm

Back
Top