var data = [];
for ( var i = 0; i < 10; i++ ){
(function(i){
data.push( func(i) );
})(i)
}
console.log( data );
var promises = [];
for (var i = 0;i<10;i++) {
promises.push(func(i));
}
Q.all(promises).then(function (results) {
console.log(results);
});