Skip to content

Instantly share code, notes, and snippets.

@brunosabot
Created March 30, 2022 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunosabot/1953d864555fcbdadd1d1deb819c6468 to your computer and use it in GitHub Desktop.
Save brunosabot/1953d864555fcbdadd1d1deb819c6468 to your computer and use it in GitHub Desktop.
const figures = [0, 1, 2, 3, 4];
const frenchFlagColors = { blue: "#00F", white: "#FFF", red: "#F00" };
const [first, ...restOfNumbers] = figures;
const { blue, ...restOfColors } = frenchFlagColors;
console.log(first); // 0
console.log(restOfNumbers); // [1, 2, 3, 4]
console.log(blue); // #00F
console.log(restOfColors); // {white: "#FFF", red: "#F00"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment