Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialErik Larson
16,777 PointsCapitalize constants?
I kind of remember a rule of thumb that declared constants should be capitalized. Something like const PI = 3.1415926535 instead of const pi = 3.1415926535. Is this more of a style thing or is it best practice to capitalize or not capitalize constants?
1 Answer
Steven Parker
231,248 PointsDeclaring constants with uppercase is a common convention.
It is recommended by the Google JavaScript Style Guide and the w3schools Coding Conventions, but it's not a universal practice.
But being consistent with naming conventions is itself a "best practice".
John Bastian Bolhano
4,800 PointsJohn Bastian Bolhano
4,800 PointsDo you use constants with uppercase?
Steven Parker
231,248 PointsSteven Parker
231,248 PointsPersonally? It depends on the intended audience of the code. But I do try to be consistent within a project about what naming convention I'm using.