Created
February 2, 2022 17:25
-
-
Save topherPedersen/de4bbb91d4a2e34c1585ba7090b641aa to your computer and use it in GitHub Desktop.
How to Pass an Array of Arguments in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function takeThreeArgs(arg1, arg2, arg3) { | |
console.log(arg1); | |
console.log(arg2); | |
console.log(arg3); | |
} | |
const myArgs = ["foo", "bar", "baz"]; | |
takeThreeArgs.apply(null, myArgs); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment