0
array = [1, 2, 3, 1, 2, 4, 5];

    for (var i = 0; i < array.length; i++){
        for (var j = 0; j < i; j++){
            //if (i != j) {
                if (array[i] == array[j]) {
                    $('#result').append(array[j]+'Repate<br>');
                }
            //}
        }
        $('#result').append(array[i]+'<br>');
    }

##  given output is
    1
    2
    3
    1 Repate
    1
    2 Repate
    2
    4
    5

## But i Want
    1
    2
    3
    1 Repate
    2 Repate
    4
    5
    Give me Some Advice....
2
Contributors
1
Reply
37
Views
2 Years
Discussion Span
Last Post by parvez alam
0

Since you are using jquery, so you can jQuery.unique() method to remove duplicate array element.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.