Skip to content

Instantly share code, notes, and snippets.

@ABIDULLAH786
Created August 3, 2023 14:18
Show Gist options
  • Save ABIDULLAH786/33b923f24360d2b4c65b8b34c9b14911 to your computer and use it in GitHub Desktop.
Save ABIDULLAH786/33b923f24360d2b4c65b8b34c9b14911 to your computer and use it in GitHub Desktop.
// Longhand
const numbers = [1, 2, 3];
const clone = numbers.slice();
const mergedArray = numbers.concat([4, 5, 6]);
// Shorthand
const numbers = [1, 2, 3];
const clone = [...numbers];
const mergedArray = [...numbers, 4, 5, 6];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment