Node.js lodash union() merge array

Description

Node.js lodash union() merge array


var _ = require('lodash');


var one = [ 1, 2, 3, 4, 5];
var two = [ 6, 7, 8, 9, 10];
var three = [ 11, 12, 13, 14, 15 ];

var both = _.union(one, two, three);

console.log(both);//from  w  w w.j  av  a  2  s  . c  o m

More example

Creates an array of unique values, in order, of the provided arrays.


var lodash = require('lodash');

console.log(lodash.union([1,2],[4,2],[2,1]))



PreviousNext

Related