Edit in JSFiddle

var my_array = ['a', 'b'];
var getList = function(){
    my_array.push(Math.random());
    return my_array;
};

for(item in getList()){
    //console.log(item);
    alert(item);
}