Created
August 24, 2011 13:25
-
-
Save javierbrea/1168048 to your computer and use it in GitHub Desktop.
Solucion funcion MAP #gejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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