Skip to content

Instantly share code, notes, and snippets.

@catwhocode
Created November 24, 2021 18:23
Show Gist options
  • Save catwhocode/dd8b7c385afc75a5aab01316789998ef to your computer and use it in GitHub Desktop.
Save catwhocode/dd8b7c385afc75a5aab01316789998ef to your computer and use it in GitHub Desktop.
Using Javascript Three Dots As Rest Arguments
// source:
// https://dev.to/sagar/three-dots---in-javascript-26ci
function myFunc(a, b, ...args) {
console.log(a); // 22
console.log(b); // 98
console.log(args); // [43, 3, 26]
};
myFunc(22, 98, 43, 3, 26);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment