The key: value syntax is the normal way to create key-value pairs in an object, but if you want a key to have the same name as an existing variable, you can omit the colon and the value. These are the same:
const radius = 2;
const color = "red";
const apple = {
radius: radius,
color: color,
};
const radius = 2;
const color = "red";
const apple = {
radius, // same as radius: radius
color: color, // set explicitly for demonstration
};
Personally, I prefer the second example when it's applicable, just because it's less verbose.