Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Created April 18, 2018 09:04
Show Gist options
  • Save gladchinda/a8ee01c2a6f4a15c583a3ff8c3c6a389 to your computer and use it in GitHub Desktop.
Save gladchinda/a8ee01c2a6f4a15c583a3ff8c3c6a389 to your computer and use it in GitHub Desktop.
const rgb = [200];
// Assign default values of 255 to red and blue
const [red = 255, green, blue = 255] = rgb;
console.log(`R: ${red}, G: ${green}, B: ${blue}`); // R: 200, G: undefined, B: 255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment