I have following JavaScript object
myObject = {
Fname: 'A',
Mname: null,
Lname: 'C',
Email: 'AB@gmail.com',
Address: null,
Login: 'AB',
Active: null
};
I want to set fields to some default value if it null
so my resulting object should be like.
Object {
Fname: "A",
Mname: "",
Lname: "C",
Email: "AB@gmail.com",
Address: "",
Login: 'AB',
Active: ""
}
Is there any fast way for doing that because in my case there are about 80 to 100 fields of object. And it takes too much time to check the fields one by one