I've seen developers declare an empty object and later assign properties and values to it but I mostly create an object and initialize the properties and values. Example
const data = {}
data.name = "John Doe";
data.age = 60;
What I mostly do is :
const data = {
name: "John Doe",
age: 60
}
I will like to know the difference between the two and why will you pick one over the other. Thanks