I really enjoyed this project. The nested grids and flexbox layouts were very pleasant to make. I have questions about my JS file: an ideas on how upgrade it?
rafael
@rafaeldevvvAll comments
- @PedrodeCTedescoSubmitted over 1 year ago@rafaeldevvvPosted over 1 year ago
Hey there! Congratulations on completing the challenge!
The JS code is good but there are always room for improvement.
The first thing to note is the use of variables. Consider using "const" to declare a variable instead of "var" or "let" when it is not meant to be reassigned. It can improve code readability and maintanibility. Also, prefer using "let" and "const" over using "var". Declaring variables with "var" can cause some scope bugs. Read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Declarations
Secondly, you declared variables that hold the same value in different functions. It is better to declare all variables outside both functions and use them inside the functions. This reduces redundancy making the code more readable.
Thirdly, you are managing each list item when you open or close the menus. I think it would be a better solution to manage the list itself when it is needed to show or hide the items.
Last, you could use that shortcut, the $ notation, to select DOM nodes to make the code shorter.
Those are my suggestions for you. Again, congratulations on completing the challenge! Hope I helped! ๐๐
Marked as helpful0