ES6 arrow function allows writing one-line functions without a return statement. However, if I try to return an object this way (without any other instruction), ES6 gets confused and thinks that I'm trying to surround my function with curly braces.
example:
const foo = (a)=>{a}
foo(1) #returns undefined instead of {a:1}
if I do
const foo = (a , b)=>{a , b}
foo(1 , 2) #returns undefined
and
const foo = (a , b)=>{a : a , b : b}
foo(1 , 2) # SyntaxError: Unexpected token
So is it impossible to return an object litteral from an arrow function without the return statement?