I know this is something that I probably learned when I first started, but don't remember how its done because I have never used it. I have an array that I am looping through and am not getting the desired results. I am trying to get the output to go like this..
One Two Three Four
Five Six Seven
But it keeps coming out as
One Two Three Four
One Two Three Four
One Two Three Four
One Two Three Four
One Two Three Four
One Two Three Four
One Two Three Four
Can someone tell me what I have done wrong?
var arr = [
"One",
"Two",
"Three",
"Four",
"Five",
"Six",
"Seven"
];
for (row = 0; row < arr.length; row++) {
for (col = 0; col < 4; col++) {
document.write(arr[col] + " ");
}
document.write('<br/>');
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>