0
I would like to take only names that repeat in an input array of type text.
For example: ['Daniel', 'Sarah', 'Mary', 'Daniel', 'Philip']
Return the 'Daniel''.
Follow the Assembly Code of the array and soon afterwards I would like to catch the repeat.
JS:
var mensagem = "";
var camposInput = new Array();
$("input[name='options2[]']").each(function () {
camposInput.push($(this).val());
});
console.log("Lista:", camposInput); // Retorna os nomes
console.log("Repetido:",?????); //Retonar o nome Repetido
It is not duplicate, I do not want to remove the repeated values, I that work with the repeated values
– Danielle Arruda torres
Danielle, the duplicate answer does not remove repeated values, it adds repeated values in an array without changing the original array.
– Sam
@Sam Truth, Already get through the answer. Thank you
– Danielle Arruda torres