Hi all. I have script that use two arrays. It pushes original array values to the newly created array. it dont pushes into new array duplicate values.
for Ex; the orginal array is var arr=new array will be var newArr=
the second three will not copied. but one disadvantage is that when it first meet the duplicated value after it it will not push another values into new array
i would like let it does like that
for ex . var arr=
var new arr=;
below is script

    <title><!-- Insert your title here --></title>
    var unique = function(origArr) {
    var newArr = [],

        origLen = origArr.length,
        x, y;

    for ( x = 0; x < origLen; x++ ) {
    //    found = undefined;
        for ( y = 0; y < newArr.length; y++ ) {
            if ( origArr[x] === newArr[y] ) {
              found = true;
        if ( !found) newArr.push( origArr[x] );
        var az=[newArr,origArr];
  return newArr;

// Test it out
var myarray = ['jeffrey', 'allie', 'patty', 'damon', 'zach', 'jeffrey', 'allie','samir'];
var az = unique(myarray);
//document.write(az); // jeffrey, allie, patty, damon, zach
    <input type="button" value="goster" onclick="document.write(az)">

thanks for attention

The problem you encounter right now is that you declare 'found' outside the for-loop scope. Once it is changed to 'true', it will always be 'true'. You need to initialize the value of 'found' before the checking loop. You did it, but it is incorrect.

Only modify your line 16 to 'found = false;' should do it.

Thank you very much. you solved problem