Recently I found out that a simple arrow function, for example callback in this map
[1, 2, 3, 4, 5, 6].map(item => {
console.log(item) // or anything else
return item - 1;
})
I can re-write to one line command like this
[1, 2, 3, 4, 5, 6].map(item => (console.log(item), item - 1))
I can use as much statements I want to devided by ,
and last argument will always be a return value. It looks kind of cool to me, but cant find anything about this syntax in arrow function documentation. Can anyone explain this syntax or just point to place where I found a docs?