Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript rest

function sum(...numbers) {
    console.log(numbers); // [1, 2, 3]
    return numbers.reduce((a, b) => a + b, 0);
}

console.log(sum(1, 2, 3)); // 6
console.log(sum(3, 2));    // 5
console.log(sum());        // 0
Source by en.wikipedia.org #
 
PREVIOUS NEXT
Tagged: #javascript #rest
ADD COMMENT
Topic
Name
7+7 =