Some of the things I've noticed:
- Avoid global variables
- It's a good decision to avoid
var
keyword as the variable declaration in 2020. Read aboutlet
andconst
- Some of the variables could be more descriptive
- Use classes instead of html tags for styling
- Instead of styling in JS. Add a CSS class in JS instead
- Look how packed with logic Your
for
loop is. It's a bit hard to understand + avoid complicated logic inside of loops. Performance is important - It's not a good practice to separate the dom elements using
<br>