JS Array map
map(func[,obj]) method applies all array elements to func method, if obj is provided, use obj as the callback Object.
function sqrt(n)
{
return Math.sqrt(n);
}
var arr = new Array(4,16,100,400);
var arrsqrt = arr.map(sqrt); //arrsqrt is [2,4,10,20]