• Why AssertionError: [1,3,1,3] === [1,3,1,3] ?

 

I tried 'Non-unique Elements'. I do not under stand [AssertionError: [1,3,1,3] === [1,3,1,3]].

Please tell me why test fail?

import assert from "assert";

function nonUniqueElements(data: number[]): number[] {
    const dup = data.filter((val, i, data) => {
      return !(data.indexOf(val) === i);
    });
    return data.filter(val => (dup.indexOf(val) != -1));
}

console.log("Example:");
console.log(nonUniqueElements([1, 2, 3, 1, 3]));

// These "asserts" are used for self-checking
assert.strictEqual(nonUniqueElements([1, 2, 3, 1, 3]), [1, 3, 1, 3]);

result:
Example:
1,3,1,3
    AssertionError: [1,3,1,3] === [1,3,1,3]
eval Line: 14 Pos: 7
.