Hello, I have solved the problem well but the test does not pass.
I have the error:
assert.js:118
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: Values have same structure but are not reference-equal:
[
1,
3,
1,
3
]
at /opt/project/test.ts:18:8
After a while I finally decided to copy exactly the same code as in the hints provided, and it returns the same error.
I don't understand where the problem comes from.
If someone could enlighten me it would be nice.
Here My code
function isUnique(arr, el) {
return arr.filter(a => a === el).length === 1
}
function nonUniqueElements(data: number[]): number[] {
// your code here
return data.filter(item => !isUnique(data, item))
}
Created at: 2022/08/28 14:14; Updated at: 2022/10/01 22:19