Javascript Array antiDiff( arr )

Description

Javascript Array antiDiff( arr )


'use strict';//from  w w  w. j  a  v a  2  s .c o  m

Array.prototype.antiDiff = function( arr ) {
    return arr.map( function( v ) {
        if ( !!~this.indexOf( v ) ) return v;
    }, this ).filter( Boolean )[ 0 ];
};



PreviousNext

Related