Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fae5111

Browse files
authored
Update code example
1 parent a4718d4 commit fae5111

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,22 +562,22 @@ be very expensive in terms of performance.
562562

563563
**Bad:**
564564
```javascript
565-
const addItemToCart = function (cart, item) {
566-
cart.push({ item: item, date: Date.now() });
565+
const addItemToCart = (cart, item) => {
566+
cart.push({ item, date: Date.now() });
567567

568568
return cart;
569-
}
569+
};
570570
```
571571

572572
**Good:**
573573
```javascript
574-
const addItemToCart = function (cart, item) {
574+
const addItemToCart = (cart, item) => {
575575
const c = Object.assign({}, cart);
576576

577-
c.push({ item: item, date: Date.now() });
577+
c.push({ item, date: Date.now() });
578578

579579
return c;
580-
}
580+
};
581581
```
582582

583583
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)