Syntax for destructuring arrays into function parameters in ES6 code example
Example 1: array destructuring methods parameters
function foo([a, b]) {
console.log(`param1: ${a}, param2: ${b}`);
}
Example 2: array destructuring methods parameters
const items = [ ['foo', 3], ['bar', 9] ];
items.forEach(([word, count]) => {
console.log(word+' '+count);
});