let difference = arr1
.filter(x => !arr2.includes(x))
.concat(arr2.filter(x => !arr1.includes(x)));
let arr1 = [1, 4, 7, 4, 2, 3];
let arr2 = [1, 2, 3, 4, 7, 18];
const is_same = arr1.length == arr2.length &&
(arr1.every((currElem)=>{
if(arr2.indexOf(currElem)> -1){
return (currElem == arr2[arr2.indexOf(currElem)]);
}return false
})
)
console.log(is_same)
const equals = (a, b) => JSON.stringify(a) === JSON.stringify(b);
let arr1 = ['1','2'];
let arr2 = ['1','2'];
equals(arr1,arr2)//this return false , if not equal then its return false
function select(arr, obj) {
const result = {};
for (let name of arr) {
if (name in obj) {
result[name] = obj[name];
}
}
return result;
}