Shorthand properties
When a variable has the same name as the property you want, write just the name: { name } instead of { name: name }.
When you build an object with braces, you normally write key: value. But if the value sits in a variable with the same name as the key, you can write just the name.
{ name, plan } means exactly the same as { name: name, plan: plan }. JavaScript takes the variable's name as the key and its value as the value.
It is written this way to avoid repeating yourself. Less noise, fewer typos.
You can mix both forms in the same object: { name, active: true }.
The course uses it in lessons like 01.03: const user = { name, plan };. It is plain JavaScript: the type checker treats it like the long form, and nothing changes when Node runs it.
Reach for it when: you build an object from variables that already have the property names you want.
Examples
Common mistake
const nombre = "Ana";
const user = { name };
console.log(user);Why: The shorthand looks for a variable named exactly `name`. Here the variable is called `nombre`, so `name` is not defined in this scope.
How to write it: Use the long form: { name: nombre }, or rename the variable.
