Skip to content

Instantly share code, notes, and snippets.

@valerymelou
Created May 20, 2018 10:51
Show Gist options
  • Save valerymelou/b668523bf0d9889fdf82d000407ee0c1 to your computer and use it in GitHub Desktop.
Save valerymelou/b668523bf0d9889fdf82d000407ee0c1 to your computer and use it in GitHub Desktop.
// Example 1
const books = ["Don Quixote", "The Hobbit", "Alice in Wonderland", "Tale of Two Cities"];
console.log(...books); // Don Quixote The Hobbit Alice in Wonderland Tale of Two Cities
// Example 2
const primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29];
console.log(...primes); // 2 3 5 7 11 13 17 19 23 29
// Example 3
const fruits = ["apples", "bananas", "pears"];
const vegetables = ["corn", "potatoes", "carrots"];
const produce = [...fruits, ...vegetables];
console.log(produce); // ["apples", "bananas", "pears", "corn", "potatoes", "carrots"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment