union
优质
小牛编辑
138浏览
2023-12-01
Creates a new sequence with all the unique elements either in this sequence or among the specified arguments.
Signature
Sequence.union = function(var_args) { /*...*/ }
Sequence.union = function union(var_args) { return this.concat(var_args).uniq(); }
Name | Type(s) | Description |
---|---|---|
var_args | ...* | The values, or array(s) of values, to be additionally included in the resulting sequence. |
returns | Sequence | The new sequence. |
Examples
Lazy(["foo", "bar"]).union([]) // sequence: ["foo", "bar"] Lazy(["foo", "bar"]).union(["bar", "baz"]) // sequence: ["foo", "bar", "baz"]