Skip to content

Instantly share code, notes, and snippets.

@javierbrea
Created August 24, 2011 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javierbrea/1168048 to your computer and use it in GitHub Desktop.
Save javierbrea/1168048 to your computer and use it in GitHub Desktop.
Solucion funcion MAP #gejs
var map=function(arr,funct){
var newArray=[],z=arr.length;
for(var i=0;i<z;i++){
newArray[i]=funct(arr[i]);
}
return newArray;
}
console.log(map([1,2,3,4],function(x){return x*x}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment