I am currently learning and trying to apply the principles of clean and modular code. As I was writing my application, I noticed that I looped through the same JSON object in different functions using the same code.

```
for(var i = 0; i < myJSONData.length; i++) {
    // do stuff with myJSONData[i]
}

```

This becomes redundant throughout the application.

```
var myJSONData = [/* array of objects */];

var myFunc = function() {
    for(var i = 0; i < myJSONData.length; i++) {
        // do stuff with myJSONData[i]
    }
}

var anotherFunc = function() {
    for(var i = 0; i < myJSONData.length; i++) {
        // do different stuff with myJSONData[i]
    }
}

```

How would I apply the DRY principle here and only write the loop once?