Let's say I have the following:
const tasks = [
["Task 1", (() => console.log(123))],
["Task 2", (() =>console.log(456))]
];
Is there a way of expressing this:
tasks.forEach( t => {
console.log(`running ! ${t[0]}`);
t[1]();
}
)
in a form resembling this:
tasks.forEach( (taskName, f) => {
console.log(`running ! ${f}`);
f();
}
)
Sadly with the (x, i) syntax, i gives me the index of the items in the list and I cannot get it to refer to the function. I also tried using the [..., ] syntax without luck