• let throws errors when reassigning variables
  • const should be used for fixed values for read-only purposes; but you can still mutate an array assigned to it. You just can't reassign it;
  • Object.freeze( obj ) to prevent object mutation
  • arrow functions! const myFunction = () => 'value';
  • pass in parameters to arrow functions: const myFunction = param => param * 2; or const multiplier = (item, multi) => item * multi; then there's passing default values for the parameters.
  • ...args: as the spread operator and the rest parameter

Destructuring and assigning variable names at the same time. The arguements must still match the attributes from the object.

const HIGH_TEMPERATURES = {
  yesterday: 75,
  today: 77,
  tomorrow: 80
};
  
const { today: highToday, tomorrow: highTomorrow} = HIGH_TEMPERATURES;

// Destructuring nested objects
const LOCAL_FORECAST = {
  yesterday: { low: 61, high: 75 },
  today: { low: 64, high: 77 },
  tomorrow: { low: 68, high: 80 }
};

const { today: {low: lowToday, high: highToday}} = LOCAL_FORECAST;