When I extract the value, I would like to remove the null
, undefined
or empty from the values. What would be the correct way to do that?
My code:
const address = {
stateProvince: null,
streetAddress: '15900 Valley View Ct',
streetAddress2: 'TF2',
streetAddress3: '2',
city: 'Sylmar',
zipCode: '91342',
countryCd: 140,
stateCd: 75,
};
const values = Object.values(address);
console.log(values) // [null, '15900 Valley View Ct', 'TF2', '2', 'Sylmar', '91342', 140, 75];
I am getting null
in the result.