Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 111: The Spread Operator (...)
Implement `updateById(list, id, patch)` returning a new array where the item with matching `id` is merged with `patch` (other items unchanged).
+ 1 hidden test run on Submit.
For the matching id you return a new object { ...item, ...patch }, preserving untouched fields and overriding changed ones. Every other item is returned as-is, so only one row changes identity and the list stays immutable.
Run your code to see results.