index.js
function(numArray) {
    numArray.sort(function (a, b) {  return a - b;  });
    for (var i=0, prev=0, diff=0, result=[], len=numArray.length; i<len; i++) {
      diff = numArray[i] - prev;
      prev = numArray[i];
      result.push(diff);
    }
    return result;
  }
function(numArray) {
    numArray.sort(function (a, b) {  return a - b;  });
    for (var i=0, prev=0, diff=0, result=[], len=numArray.length; i<len; i++) {
      diff = numArray[i] - prev;
      prev = numArray[i];
      result.push(diff);
    }
    return result;
  }
function ( numArray ) { numArray . sort ( function ( a , b ) { return a - b ; } ) ; for ( var i = 0 , prev = 0 , diff = 0 , result = [ ] , len = numArray . length ; i < len ; i ++ ) { diff = numArray [ i ] - prev ; prev = numArray [ i ] ; result . push ( diff ) ; } return result ; }
Converts an array of number values to array of differences between each pairs of values
for example : [100, 101, 102, 103, 104, 105] => [100, 1, 1, 1, 1, 1]
@param {array<number>}
@return {array<number>}
Converts an array of number values to array of differences between each pairs of values for example : [ 100 101 102 103 104 105 ] = > [ 100 1 1 1 1 1 ]