v1
6/6/2022 by 10basetom -00
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const arr1 = ['A', 'B', 'C'];
const arr2 = ['A', 'D', 'C', 'E'];

function diffArray1(a1, a2) {
  let aDiffs = [];
  a1.filter((i) => {
    if (a2.indexOf(i) < 0) {
      aDiffs.push(a1.indexOf(i));
    }
  });
  return aDiffs;
};

function diffArray2(a1, a2) {
  let aDiffs = [];
  for (let i=0; i<a1.length; ++i) {
    if (a2.indexOf(a1[i]) < 0) {
      aDiffs.push(a1.indexOf(a1[i]));
    }
  }
  return aDiffs;
};

function diffArray3(a1, a2) {
  let aDiffs = [];
  for (let i=0; i<a1.length; ++i) {
    if (a1[i] !== a2[i]) {
      aDiffs.push(i);
    }
  }
  return aDiffs;
};

delete caserun single casemove downdrag and drop case


ready



diffArray1(arr2, arr1); // Returns [1, 3]
delete caserun single casemove upmove downdrag and drop case


ready



diffArray2(arr2, arr1); // Returns [1, 3]
delete caserun single casemove updrag and drop case


ready



diffArray3(arr2, arr1); // Returns [1, 3]
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