function baseMap(collection, callback) {
    // initialize the array
    let results = [];
    // execute callback only if it is a function and collection is an array
    if(typeof callback == 'function' && Array.isArray(collection)) {
      for(let i = 0, len = collection.length; i < len; i++) {
        results[i] = callback(collection[i], i, collection);
      }        
    }
    // return the mapped array
    return results;
  }
/*
  * @param(collection) - Array|Object to iterate
  * @param(callback) - callback function that needs to be called on each iter
  * @return - new Array with mapped value
  */
@param(collection) - Array|Object to iterate
@param(callback) - callback function that needs to be called on each iter
@return - new Array with mapped value
@param ( collection ) - Array|Object to iterate @param ( callback ) - callback function that needs to be called on each iter @return - new Array with mapped value
function baseMap(collection, callback) {
    let results = [];
    if(typeof callback == 'function' && Array.isArray(collection)) {
      for(let i = 0, len = collection.length; i < len; i++) {
        results[i] = callback(collection[i], i, collection);
      }        
    }
    return results;
  }
function baseMap ( collection , callback ) { let results = [ ] ; if ( typeof callback == 'function' && Array . isArray ( collection ) ) { for ( let i = 0 , len = collection . length ; i < len ; i ++ ) { results [ i ] = callback ( collection [ i ] , i , collection ) ; } } return results ; }
@param(collection) - Array|Object to iterate
 @param(callback) - callback function that needs to be called on each iter
 @return - new Array with mapped value
@param ( collection ) - Array|Object to iterate @param ( callback ) - callback function that needs to be called on each iter @return - new Array with mapped value
// initialize the array // execute callback only if it is a function and collection is an array // return the mapped array