JS Hapus objek yang tidak ditentukan

const person = { "name":"bill", "age":21, "sex":undefined, "height":null, "hidden":false };
//remove null and undefined values
const cleanPerson = _.pickBy(person, x => x !== null && x !== undefined);
//cleanPerson is now { "name":"bill", "age":21, "hidden":false }
Merlin4 (personal)