
The Definitive Guide to Text Case Conventions in Programming
Every programming language and framework has opinions about text casing. Use the wrong convention and your code either breaks or fails code review. The rules are not arbitrary -- they encode information about what a name represents. The major cases camelCase: First word lowercase, subsequent words capitalized. No separators. Used for variables, function names, and object properties in JavaScript, Java, and C#. let userName = ' Alice ' ; function calculateTotal () {} PascalCase (UpperCamelCase): Every word capitalized. Used for class names, components, and types in most languages. class UserAccount {} function DropdownMenu () {} // React component type HttpResponse = {} // TypeScript type snake_case: All lowercase, words separated by underscores. Used for variables and functions in Python, Ruby, and Rust. user_name = ' Alice ' def calculate_total (): pass SCREAMING_SNAKE_CASE: All uppercase, words separated by underscores. Used for constants in virtually every language. const MAX_RETRIE
Continue reading on Dev.to JavaScript
Opens in a new tab




