fac25 / fac25-week5-Lisa-Manoela

Memory game
https://mellow-stardust-0186d5.netlify.app/
0 stars 0 forks source link

UNCLE BOB #24

Closed patdel0 closed 1 year ago

patdel0 commented 1 year ago

Uncle Bob is nitpicking because he can't find much in the project...

https://github.com/fac25/fac25-week5-Lisa-Manoela/blob/a3bac004b9362f5ceb7f656f7f1c193d610fe7df/src/Game.jsx#L85

For the reader of this line of code, it might not be clear that we are checking if it's the last level. An alternative to using the 'magic number' 5 would be to assign it to a variable named 'lastLevel'.

const LAST_LEVEL = 5;
if(level === lastLevel) {setGameOver(true)} 

By removing 'magic numbers', our code tends to become cleaner/easier to understand for the reader.

This is a resource that I like to refer to every now and then, when I have nothing to do: clean-code-javascript

The repository is based on Uncle Bob's Clean Code book.