diff --git a/guide/english/javascript/arrow-functions/index.md b/guide/english/javascript/arrow-functions/index.md index a8ce0a8eac..d8be25e6ca 100644 --- a/guide/english/javascript/arrow-functions/index.md +++ b/guide/english/javascript/arrow-functions/index.md @@ -40,6 +40,9 @@ const multiply = (x, y) => x * y; // if you only have one argument/parameter const multiplyBy2 = x => x * 2; +// if you need to concisely return an object, you can wrap the {} inside the () to avoid syntax conflicts +const getSumProductObject = (x, y) => ({sum : x + y, product: x * y}); + // combined with the ternary operator, but note it's not a looker! const addOrMultiply = (x, y, mathOperator) => mathOperator.toLowerCase() === 'add' ? x + y : x * y; ```