Skip to content

Instantly share code, notes, and snippets.

@alisaliso
Created September 23, 2020 13:52
Show Gist options
  • Save alisaliso/2e53c55880b8cf4941adcba753b3e8a9 to your computer and use it in GitHub Desktop.
Save alisaliso/2e53c55880b8cf4941adcba753b3e8a9 to your computer and use it in GitHub Desktop.
ReactJS Developer komoot 2
// Double input with non-arrow function and it's arguments object
function doubleNumbers() {
return [...arguments].map((a) => a * 2);
}
// or with arrow function and destructured parameters
const doubleNumbers = (...args) => {
return args.map((a) => a * 2);
};
// or with function declaration and destructured parameters
function doubleNumbers(...args) {
return args.map((a) => a * 2);
};
console.log(doubleNumbers(1, 2, 3));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment