I have an array as such:
let newArray = $('#TA2').val().split('\n');
Where #TA2
is a textarea
. The output from console.log
is:
["542|519", "542|519", "540|500"]
I want to show only the values that are duplicate, so the output should be: ["542|519"]
How do i do this using js/jquery? everything i try won't work unfortunately and i'm in need of help..
The diffrence in this question related to others is that i want my array to be dynamic with textarea
input hence the first variable newArray that gets the values from the textarea
to create a new array. The end-goal is to add a <button>
, when clicked on a array should be created from the textarea
and must only show the duplicate values.