<!DOCTYPE html>
<html>
<body>

<p>Click the button to display the formatted number.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var num = 13.3714;
    document.getElementById("demo").innerHTML = num.toPrecision(2);
}
</script>

</body>
</html>