0
I have a paper to do on a subject about mathematics so I have to do about sets so I thought I’d make an intersection that would show only the numbers that repeat in both sets, but I can’t get it, I was only able to collect the data and show the typed sets.
var elemento = [];
var conjuntos = [];
numcon = prompt("Digite o Numero de Conjuntos:", "")
if (numcon == 0) {
  alert("Numero de Conjunto tem que ser maior que zero")
} else {
  for (var i = 1; i <= numcon; i++) {
    numelemt = prompt("digite o numero de elmentos do " + "  " + i + "º" + "  conjuntos:", "")
    conjuntos[i - 1] = [];
    if (numelemt == 0) {
      alert("Este conjunto sera nulo")
    } else {
      for (var cont1 = 1; cont1 <= numelemt; cont1++) {
        elemt = window.prompt("Digite o" + " " + cont1 + "º" + " " + "elemento do conjunto nº" + " " + i);
        conjuntos[i - 1].push(elemt)
      }
    }
  }
}
console.log(conjuntos)
for (var cont3 = 0; cont3 < conjuntos.length; cont3++) {
  document.write("<br>" + "conjunto " + (cont3 + 1) + " é {")
  for (var cont4 = 0; cont4 < conjuntos[cont3].length; cont4++) {
    if (cont4 == conjuntos[cont3].length - 1) {
      document.write(conjuntos[cont3][cont4]);
    } else {
      document.write(conjuntos[cont3][cont4] + ",");
    }
    //conjunto 1 é: {552655}
  }
  document.write("}");
}
You can give an example of that input you want to compare?
– Sergio
by ex I am typing the numbers of two sets the first 1,2,3,4, and the second 3,4,5,6, hence I wanted to compare these two vectors to show me the equal numbers in the two , that would be the 3,4
– Edson Amarante