JavaScript Lingo: Variables & camelCase
What constitutes a variable, and the reasoning behind camelCase.
A variable, also referred to as 'var', is the name or placeholder for a boolean, string, number, or other piece of static information.
Let's use google dev tools to inspect the free code camp home page and look for some variables.
You 'declare' variables the first time with 'var' in front of it, but those can be referenced later in your script.
camelCase is the way that JavaScript pushes words together and still keeps them legible. The first letter of the first word is lowercase, along with the remainder of the word, but the first letter of every consecutive word is capitalized. There are no spaces. Examples: brianaLovesHerPets, bestFoodIsCheese, and codeIsWorthLearning.
When you name variables, utilize camelCase. Also try to keep the names descriptive and short so that others (and yourself!) can tell what that variable is referring to just by the name.
Other Videos By freeCodeCamp.org
2015-08-24 | Chrome Dev Tools: Timeline Tab |
2015-08-24 | Chrome Dev Tools: Sources Tab |
2015-08-24 | Chrome Dev Tools: Network Tab |
2015-08-24 | Chrome Dev Tools: Elements Tab |
2015-08-23 | JavaScript Lingo: Regular Expressions |
2015-08-23 | JavaScript Lingo: Loops |
2015-08-23 | JavaScript Lingo: Math |
2015-08-23 | JavaScript Lingo: Manipulating Data |
2015-08-23 | JavaScript Lingo: Finding and Indexing Data in Arrays |
2015-08-23 | |
2015-08-23 | JavaScript Lingo: Variables & camelCase |
2015-08-23 | JavaScript Lingo: Value Types |
2015-08-23 | JavaScript Lingo: MDN and Documentation |
2015-07-17 | Computer Basics 17: How Routers and Packets work |
2015-07-17 | Computer Basics: Chips and how Moore's Law works |
2015-07-17 | Computer Basics 15: Analog vs Digital and how File Compression works |
2015-07-17 | Basejump: Build a Pinterest Clone |
2015-07-17 | Computer Basics 18: How Source Code works |
2015-07-17 | Computer Basics 19: How Variables work in Code |
2015-07-17 | Computer Basics 21: Chrome JavaScript Console and how Logging works |
2015-07-17 | Computer Basics 20: What Do Programmers Do? |