a = [1,2,3,4,4] b = [3,4,5,6,7] p a | b # 和集合 [1,2,3,4,5,6,7] p a - b # 差集合 [1,2] p a & b # 積集合 [3,4] var _ = require('lodash'); var a = [1,2,3,4,4] var b = [3,4,5,6,7] console.log(_.union(a, b)); // 和集合(union) [1,2,3,4,5,6,7] console.log(_.difference(a, b)); // 差集合(difference set) [1,2] console.log(_.intersection(a, b)); // 積集合(intersection) [3,4]