The array_map(), and array_search() functions are generally known and used in PHP. These functions are useful when working with arrays.  (JavaScript)
Leetness: 2  

//array_map(callback, arr1) - returns an array containing all the elements of arr1 after applying the callback function to each one.

function array_map(func, array) {
  if(array.constructor.toString().match(/array/ig)) result = new Array();
  else if(array.constructor.toString().match(/object/ig)) result = new Object();
  if(result) {
    for(var indice in array) {
      result[indice] = eval(func+'('+array[indice]+')');
    }
    return result;
  }
}

     
Submitted on May 02, 2013 by Anonymous