repeated code - declare functions
- Dominant language
- HTML
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
#### you repeat the same logic multiple times
the problem :
https://github.com/GSG-G10/Watch-Store/blob/860921c81a5ffc1e9d3981d9bc804e0b7a569c23/scripts/dom.js#L68
https://github.com/GSG-G10/Watch-Store/blob/860921c81a5ffc1e9d3981d9bc804e0b7a569c23/scripts/dom.js#L82
solution :
```javascript=
const getItemsFromLocalStorage=(name)=>localStorage.getItem(name)
const productNumber = getItemsFromLocalStorage('cartNumber')
```
* the same problem with setItem
```javascript=
const setItemToLocalStorage=(name,data)=> localStorage.setItem(name,data); // declaration
setItemToLocalStorage ('productsInCart',JSON.stringify(cartItems)); // calling
```
``` all those functions declare on utils.js file ```
#### set all query selectors on the top of the dom file
* useless of declaring functions, just store it on variable
https://github.com/GSG-G10/Watch-Store/blob/860921c81a5ffc1e9d3981d9bc804e0b7a569c23/scripts/dom.js#L11-L22
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.