Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript pass all arguments to another function

function func1() {
  const reverse = func2(...arguments); // "rest operator" passes arguments
  return reverse.join("");
}

function func2() {
  return Array.from(arguments).reverse();
}

func1("a", "b", "c"); // "cba"
 
PREVIOUS NEXT
Tagged: #javascript #pass #arguments #function
ADD COMMENT
Topic
Name
9+8 =