I have a two-dimensional array (`affiliates`) where each array item consists of an image URL and a link URL. `randArray` is simply a generated list of random numbers (non-repeating) that matches the length of `affiliates`.

I've gotten to the point where I can successfully generate an HTML string for randomized image/url combinations. 

(The above might be more information than needed but I wanted to provide a little background.) 

What I'm trying to do is group every three iterations together and wrap in `<p>` tags. I've tried doing a nested loop inside the current one but could only get to where it was wrapping three of the *same* line in a `<p>` tag, whereas I need them to be three successive lines. I feel like this should be pretty easy, but I'm stumped. Any help would be much appreciated. 

```
for(var y=0; y < randArray.length; y++) {

    var image = affiliates[randArray[y]][0];
    var url = affiliates[randArray[y]][1];

    var fullString = '<a href="' + url + '"><img src="' + image + '"></a>';
    console.log(fullString);

}

```