Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Passing arrays to functions with the spread operator

let numbers = [ 1, 2, 3 ]
let myFunction = (x, y, z) => {
    return x + y + z;
}

// Returns 6
let getCalculation = myFunction(...numbers);
Source by devdojo.com #
 
PREVIOUS NEXT
Tagged: #Passing #arrays #functions #spread #operator
ADD COMMENT
Topic
Name
5+7 =