v1
2/24/2023 by tagurit -00
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
let array1 = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",  "q", "u", "y"]
let array2 = ["b", "f", "j", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
let array3 = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
delete caserun single casemove downdrag and drop case


ready



var a = [...new Set([...array1 ,...array2])];
delete caserun single casemove upmove downdrag and drop case


ready



var a = array1.concat(array2);
for (var i = 0; i < a.length; ++i) {
    for (var j = i + 1; j < a.length; ++j) {
        if (a[i] === a[j])
            a.splice(j--, 1);
    }
}
delete caserun single casemove upmove downdrag and drop case


ready



var a = array1.slice();
array2.forEach(v => { a.includes(v) ? null : a.push(v) })
delete caserun single casemove upmove downdrag and drop case


ready



var arr = array1.concat(array2),
  len = arr.length,
  a = [];

while (len--) {
  var itm = arr[len];
  if (a.indexOf(itm) === -1) {
    a.unshift(itm);
  }
}
delete caserun single casemove upmove downdrag and drop case


ready



var a = array1.concat(array2.filter(function(i) {
  return array1.indexOf(i) == -1;
}));
delete caserun single casemove upmove downdrag and drop case


ready



array2.forEach(v => array1.includes(v) ? null : array1.push(v));
delete caserun single casemove updrag and drop case


ready



for (var i = 0; i < array2.length; i++)
    if (array1.indexOf(array2[i]) === -1)
      array1.push(array2[i]);
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN