Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function průnik(a, b, c) {
- var x = [];
- a.forEach(function(item) {
- if(b.indexOf(item) !== -1) x.push(item);
- });
- return c?arguments.callee.apply(this,
- Array.prototype.concat.call(
- [x], Array.prototype.slice.call(
- arguments, 2
- )
- )
- ):x;
- }
- function sjednocení(a, b, c) {
- var x = a.slice(0);
- b.forEach(function(item) {
- if(x.indexOf(item) === -1) x.push(item);
- });
- return c?arguments.callee.apply(this,
- Array.prototype.concat.call(
- [x], Array.prototype.slice.call(
- arguments, 2
- )
- )
- ):x;
- }
- function rozdíl(a, b, c) {
- var x = [];
- a.forEach(function(item) {
- if(b.indexOf(item) === -1) x.push(item);
- });
- return c?arguments.callee.apply(this,
- Array.prototype.concat.call(
- [x], Array.prototype.slice.call(
- arguments, 2
- )
- )
- ):x;
- }
- function symetrickýRozdíl(a, b, c) {
- var x = rozdíl(
- sjednocení(a, b),
- průnik(a, b)
- );
- return c?arguments.callee.apply(this,
- Array.prototype.concat.call(
- [x], Array.prototype.slice.call(
- arguments, 2
- )
- )
- ):x;
- }
Advertisement
Add Comment
Please, Sign In to add comment