Skip to content

Commit 6b16391

Browse files
authored
1 parent 3a0c3a9 commit 6b16391

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,13 @@ To do so, we only need to **remove the brackets** and the **return** keyword. Th
362362

363363
> **Note:** If your function does not return a value (with *side effects*), it doesn't do an explicit nor an implicit return.
364364
365+
Besides, if you want to implicitly return an *object* you **must have parenthesis around it** since it will conflict with the block braces:
366+
367+
```js
368+
const getPerson = () => ({ name: "Nick", age: 24 })
369+
console.log(getPerson()) // { name: "Nick", age: 24 } -- object implicitly returned by arrow function
370+
```
371+
365372
- Only one argument
366373

367374
If your function only takes one parameter, you can omit the parenthesis around it. If we take back the above *double* code:

0 commit comments

Comments
 (0)