Edit in JSFiddle

function CatMaker(name) {
    return {
        speak: function () {
            console.log("Miaow my name is " + name);
        }
    };
}

var catNames = ['Charlie', 'Fluffy', 'Mouse'];
var cats = [];

for (var i = 0, len = catNames.length; i < len; i++) {
    cats.push(CatMaker(catNames[i]));
}

for (var i = 0, len = cats.length; i < len; i++) {
    cats[i].speak();
}

              
            
          
            
              
                

              
            
          
            
              

External resources loaded into this fiddle: