javascript function in object literal get return value code example
Example 1: javascript return object in arrow function
const func = () => ({ foo: "bar" });
console.log(func()); // { foo: "bar" }
Example 2: how to return an object in javascript
function func() {
return {
name: "Name",
age: 34
};
}