const foo = () => {
return {
name: 'Alex',
age: '24',
};
};
const bar = () => ({
name: 'Alex',
age: '24',
});
console.log(foo()) // {name: 'Alex', age: '24'}
console.log(bar()) // {name: 'Alex', age: '24'}
As i understand, if i need a function just for return an object, i can use a second syntax (without return) ?