Javascript tofixed


       table {
        border: 1px solid #666;
        width: 100%;
       td {
        border: 1px solid black;

 <script src=""></script>



<div id="div1">
 <table id="tbl1">


<script type="text/javascript">
function drawTable(data){
        for (var i = 0; i < data.length; i++){
function drawRow(rowData){
        var row = $("<tr />");
        row.append($("<td>" + + ")</td>"));
        row.append($("<td>" + rowData.naam + "</td>"));
        row.append($("<td>" + rowData.perc * 100  + "</td>"));
function loadBier() {
        $.getJSON( "",
            function( data ) {
                console.log("AJAX-data through jQuery:12", data);

                $("#div1").append( drawTable(data));


how do i add a .toFixed so the numbers will be with 2decimals
in the
row.append || rowData.perc

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


(rowData.perc * 100).toFixed(2)

thank you very much
appreciate it