v1
- by hkotsubo 8/11/202100
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
let mdcOperands = [[2, 2, 3, 5], [2, 2, 5, 5], [2, 3, 5, 5]];
function intersect(s1, s2) {
    var result = new Set();
    for (var x of s1)
        if (s2.has(x))
            result.add(x);
    return result;
}

delete caserun single casemove downdrag and drop case


ready



let flatOperands = mdcOperands.flat()
let repetidos = []
flatOperands.map(function(item,index){
  if((flatOperands.indexOf(item) !== index) && (repetidos.indexOf(item)=== -1)){
      repetidos.push(item)}
})
for (let i = 0;i<repetidos.length;i++){
  mdcOperands.map((item,index)=>{
    item.indexOf(repetidos[i]) === -1 ? repetidos.splice(i,1):''
  })
}
delete caserun single casemove updrag and drop case


ready



let result = new Set(mdcOperands[0]);
for(var i = 1; i < mdcOperands.length; i++) {
    result = intersect(result, new Set(mdcOperands[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