javascript. - foreach/map/filter . . :
function List (array) {
if (array !== undefined) {
this.push.apply(this,array)
}
this.each = function (callback) {
var ret = new List();
for (i=0,l=this.length;i<l;i++) {
var r = callback(this[i],i);
if (r !== undefined) {
ret.push(r);
}
}
return ret;
}
}
List.prototype = new Array();
var justColumnNames = new List();
justColumnNames.each(function(n,i){
n = columnsInfo[i].Name;
});
var justColumnNames = new List(columnsInfo).each(function(n){return n.Name});
, :
Array.prototype.each = function (callback) {
}
.