(error)?{
console.log(error)
api.submit(error)
}:{
serveFood(food)
getMoney()
}
return return from api.submit(error) or return from getMoney()
(error)?{
console.log(error)
api.submit(error)
}:{
serveFood(food)
getMoney()
}
return return from api.submit(error) or return from getMoney()
You may be interested in https://github.com/tc39/proposal-do-expressions
Actually...
{} itself could work for code block.
And {}() for executing
No, it can't. {…}
in an expression context is an object literal.
const value = 5;
const example = true ? { value } : null;
will assign {value: 5}
to example
, whereas
const value = 5;
const example = true ? do { value } : null;
will assign 5
to example
.
It could have been callable like a function... just () afterwards...