function omit(obj, arr){ obj1 = {...obj}; for(let i in obj1) { if(arr.includes(obj1[i])) { delete obj1[i]; } } return obj1; } obj = { key1:"nihao", key2:"fs", key3:"hello" }; arr = ["hello", "fs"]; w = omit(obj, arr); for(let i in w) { console.log(w[i]) }