Write a Javascript assignment statement to round the variable X to 4 decimal places and store the result in variable Y.
JAVASCRIPT :
<!DOCTYPE html>
<html>
<body>
<p id="ques"></p>
<script>
var X = 4.557845566;
var Y = X.toFixed(4);
document.getElementById("ques").innerHTML = Y;
</script>
</body>
</html>
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.