function occurrence(array) {
  const result = {};
  if (array instanceof Array) {
    array.forEach((x, i) => {
      if (!result[x]) {
        result[x] = [i];
      } else {
        result[x].push(i);
      }
    });
  }
  return result;
}
/**
 * Get occurrence of a property
 * @param array
 */
Get occurrence of a property
@param array
Get occurrence of a property @param array
function occurrence(array) {
  const result = {};
  if (array instanceof Array) {
    array.forEach((x, i) => {
      if (!result[x]) {
        result[x] = [i];
      } else {
        result[x].push(i);
      }
    });
  }
  return result;
}
function occurrence ( array ) { const result = { } ; if ( array instanceof Array ) { array . forEach ( ( x , i ) => { if ( ! result [ x ] ) { result [ x ] = [ i ] ; } else { result [ x ] . push ( i ) ; } } ) ; } return result ; }
Get occurrence of a property
 @param array
Get occurrence of a property @param array