JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://underscorejs.org/underscore-min.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css">
<div class="container-fluid">
    <div class="row-fluid">
        <!-- MARKUP GOES HERE -->
        <div id="numbers"></div>
        <!-- END MARKUP -->
    </div>
</div>

<!-- http://html-ipsum.com/ for sample markup -->

CSS

body { margin-top: 20px; }

JavaScript

function truncate(num,precision) {
    var muldiv = Math.pow(10,precision-1);
    return Math.floor(num * muldiv) / muldiv;
}

$(function(){
    var number = 1.23446789,
        outputList = $('<ul>'),
        fixed = number.toFixed(3),
        precise = number.toPrecision(4),
        truncated = truncate(number,4);
    
    outputList.append($('<li>number.toFixed(3) = ' + fixed + '( ' + typeof fixed +' )</li>'));
    outputList.append($('<li>number.toFixed(4) = ' + precise + ' ( ' + typeof precise + ' )</li>'));
    outputList.append($('<li>truncate(number,4) = ' + truncated + '( ' + typeof truncated + ' )</li>'));
    
    $('#numbers').append(outputList);
    
});