I have an object that looks like this:
PetForm
{
name:"Bobo",
type:"Golden Retriever",
food:null,
toys:null,
....
}
I want to replace the fields with the values of null to an empty string like this:
Result:
{
name:"Bobo",
type:"Golden Retriever",
food:"",
toys:"",
....
}
I did the following:
Object.keys(PetForm).forEach((key) => (PetForm[key] === null) && PetForm[key] == "");
Am I missing something in this method?