arrow function returning values js code example
Example 1: javascript return object in arrow function
const func = () => ({ foo: "bar" });
console.log(func()); // { foo: "bar" }
Example 2: arrow func in javascript
const greet = (who) => {
return `Hello, ${who}!`;
};
greet('Eric Cartman'); // => 'Hello, Eric Cartman!'