Skip to content

Commit f3b12d3

Browse files
committed
Remove unnecessary Boolean conversion
1 parent 916990f commit f3b12d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/3/en/part3a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ app.post('/api/notes', (request, response) => {
677677

678678
const note = {
679679
content: body.content,
680-
important: Boolean(body.important) || false,
680+
important: body.important || false,
681681
id: generateId(),
682682
}
683683

@@ -705,7 +705,7 @@ If the content property has a value, the note will be based on the received data
705705
If the <i>important</i> property is missing, we will default the value to <i>false</i>. The default value is currently generated in a rather odd-looking way:
706706

707707
```js
708-
important: Boolean(body.important) || false,
708+
important: body.important || false,
709709
```
710710

711711
If the data saved in the _body_ variable has the <i>important</i> property, the expression will evaluate its value and convert it to a boolean value. If the property does not exist, then the expression will evaluate to false which is defined on the right-hand side of the vertical lines.

0 commit comments

Comments
 (0)