function get_unique_values(arr1, arr2) {
const set1 = new Set(arr1);
const set2 = new Set(arr2);
const result = [];
arr1.forEach(item => {
if (!set2.has(item)) {
result.push(item);
}
});
arr2.forEach(item => {
if (!set1.has(item)) {
result.push(item);
}
});
result.sort((a, b) => a - b);
return result;
}
const arr1 = [1, 3, 6, 8, 12, 90];
const arr2 = [2, 3, 5, 6, 7, 8, 12, 85, 96];
const result = get_unique_values(arr1, arr2);
console.log(result);
/*
run:
[
1, 2, 5, 7,
85, 90, 96
]
*/