Skip to content

Instantly share code, notes, and snippets.

@kironroy
Created May 18, 2023 00:58
Show Gist options
  • Save kironroy/b0ce17ea4c59bdc965b4e56c9323d6eb to your computer and use it in GitHub Desktop.
Save kironroy/b0ce17ea4c59bdc965b4e56c9323d6eb to your computer and use it in GitHub Desktop.
...REST
// functions REST
const add = function (...numbers) {
let sum = 0;
for (let i = 0; i < numbers.length; i++) sum +=
numbers[i];
console.log(sum);
};
add(2, 3);
add(5, 6, 7, 8, 9);
add(1, 2, 3, 4, 5, 6, 7, 8, 9);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment