Testing Mustache.js Template

HTML

<script src="https://github.com/janl/mustache.js/raw/master/mustache.js"></script>
<div id="moustacheHtml"></div>
<hr />
<div>As seen on <a href="https://github.com/janl/mustache.js" target="_blank">https://github.com/janl/mustache.js</a>

</div>

<script id="mustache-template" type="text/template">
    <table>
        {{#rows}}
        <tr class="">
            <td>{{value}}</td>
        </tr>
        {{/rows}}
    </table>
</script>

CSS

div {
    font:14px Arial;
    margin:50px 20px;
}

JavaScript

$(function () {
    var tableRows = [{
        name: 'name1',
        values: ['1', '2', '3']
    }, {
        name: 'name2',
        values: ['1', '2', '3']
    }, {
        name: 'name3',
        values: ['1', '2', '3']
    }];
    var mustacheFormattedData = {
        'value': []
    };

    for (var row in tableRows) {
        if (tableRows.hasOwnProperty(row)) {
            var obj = tableRows[row]
            for (var prop in obj) {
                if (obj.hasOwnProperty(prop)) {
                    console.log(prop)
                    mustacheFormattedData['value'].push({
                        'value': obj[prop]
                    });
                }
            }
        }
    }

    template = $('#mustache-template').html();
    console.log(mustacheFormattedData['value'])
    $('#moustacheHtml').append(Mustache.render(template, {
        rows: mustacheFormattedData['value']
    }));
});