Briefle words · Code & architecture
Spread syntax
The JavaScript '...' operator that copies the contents of an object or array into a new one.
Say it to an AI
TypeScript addMedication(patient, med) for our React patient chart. Keep it immutable: return a new Patient using spread syntax with the medication appended and a fresh updatedAt, never mutate the input, since the old object sits on the undo stack.
How an expert would brief the stronger version of “Add a medication”.
See it
Try it as a puzzle →A clinic's patient-chart web app adds a prescription to the patient on screen, with undo.
Why: A uses '...patient' and '...patient.medications' to build fresh copies before adding 'med'.
Related words
Room 3 · Functions & structure
Learn “Spread syntax” in a five-minute lesson