refactor ``` setItems ``` function
- Dominant language
- HTML
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
* instead of re-assign the value call all methods on one line.
https://github.com/GSG-G10/Watch-Store/blob/860921c81a5ffc1e9d3981d9bc804e0b7a569c23/scripts/dom.js#L82-L83
```javascript=
const cartItems=JSON.parse(localStorage.getItem('productsInCart'));
```
* no need to make a condition, the if automatically convert all [falsy values](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) to a boolean value (false)
https://github.com/GSG-G10/Watch-Store/blob/860921c81a5ffc1e9d3981d9bc804e0b7a569c23/scripts/dom.js#L84
https://github.com/GSG-G10/Watch-Store/blob/860921c81a5ffc1e9d3981d9bc804e0b7a569c23/scripts/dom.js#L85
```
if(cartItems){
if(!cartItems[product.title]){
cartItems={
...cartItems,[product.title]:product
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.