Design comparison
SolutionDesign
Solution retrospective
Happy to be able to use calc and browser dev tools to center text perfectly. Remembering JS was a challenge.
What are good conventions for naming JS variable vs JS functions? It would be nice to differentiate them by name rather than by brackets or code color.
Community feedback
- @fazzaamiarsoPosted over 2 years ago
Hello Poldini!
In general, for naming you want the name to be clear and meaningful. Your naming should be understandable without extra mental mapping.
- for boolean , usually you want to prefix them with is, has, should, etc. EX :
isLoading
,hasAddress
,shouldFetch
. - you also want the naming easy to understand and meaningful. So, instead of
yymmdd
for date, you can make it clearer tocurrentDate
, - for word casing, the convention is to use camelCase or snake_case (usually for server side)
- for function, it is better to prefix them with verbs such as
append
,get
,fetch
. EX:fetchUser
,getResponse
.
Here is a resource if you want to dig deeper.
Hope it helps! Cheers!
1 - for boolean , usually you want to prefix them with is, has, should, etc. EX :
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord