const myObject = {
key1: "Hello",
key2: null,
key3: "",
key4: undefined,
key5: "World"
};
const filteredObj = obj =>
Object.entries(obj)
.filter(([_, value]) => !!value)
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {});
console.log(filteredObj(myObject));
_x000D_