- Spread
...unpacks arrays, strings and objects: copying, combining, and passing array items as arguments (Math.max(...nums)). - Rest
...packs things up:function f(...args)collects arguments into an array, andconst { secret, ...others } = objcollects remaining properties. - Destructuring can swap variables (
[a, b] = [b, a]), reach into nested data, and work insidefor...ofloops. - Optional chaining
?.stops and returnsundefinedinstead of crashing when something isnullorundefined. - Nullish coalescing
??provides a default only fornull/undefined.||provides a default for any falsy value (including0and""). &&and||return one of their actual values, not justtrue/false.||=,&&=and??=combine them with assignment.- A
Setholds unique values:add,has,delete,size.[...new Set(arr)]removes duplicates. - A
Mapholds key-value pairs with any type of key:set,get,has,delete,size. Datemonths go from 0 to 11! Subtract dates to get milliseconds. UsetoLocaleDateStringto display them.
Reading is step one
CurlyScript turns these notes into a game: short questions, an explanation after every answer, and a test at the end of each grade. Free, with nothing to sign up for.