Q:

What is wrong with this for loop?

Hi guys I have an array that I'm trying to append to the DOM!
Here is the code:
function inputFeedContent(data){
    for(var k=0; k < columns; k++) {
        var col = "<div class='col-1'>";
        for(var j=0; j < data.sample[k].length; j++) {
            col += "<p>"+data.sample[k][j]+"</p>";
        }
        col += "</div>";
        $('.sliding-window').append(col);
    }
}

where columns = 12. 
Problem is I only get five of these:
<div class="col-1">
    <p>Some text</p>
</div>

What am I doing wrong here? Keep in mind I'm a noob :) 
Thanks!

A:

I think you're trying to print each column separately, hence not row after row.
Try this:
function inputFeedContent(data) {
    for(var k=0; k < columns; k++) {
     var col = "<div class='col-1'>";
     for(var j=0; j < data.sample.length; j++) {
        col += "<p>"+data.sample[j][k]+"</p>";
     }
     col += "</div>";
     $('.sliding-window').append(col);
    }
}

