Answers for "...args in object destructuring javascript"

6

javascript multiply arguments

const mul = (...args) => args.reduce((a, b) => a * b);

// Example
mul(1, 2, 3, 4);    // 24
Posted by: Guest on July-03-2020
0

array destructuring methods parameters

const items = [ ['foo', 3], ['bar', 9] ];
items.forEach(([word, count]) => {
    console.log(word+' '+count);
});
Posted by: Guest on January-05-2021
0

array destructuring methods parameters

function foo([a, b]) {
   console.log(`param1: ${a}, param2: ${b}`);
}
Posted by: Guest on January-05-2021

Code answers related to "...args in object destructuring javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language