By Guil Hernandez
There are a few other rules you'll need to follow as well. Names can't start with a number. So a variable named 9lives is not allowed, but a variable named right1 is. Names can only contain letters, numbers, and the $ and _ characters. So the names numOfUnitsBy# or @home are not allowed, but variables like price$ and created_by are permitted.
Many programmers use variable names that combine two or more words. It's common to name those variables by either connecting the words with an underscore like price_per_unit or capitalizing every word after the first word like pricePerUnit.
Capitalizing every word following the first is called camel case by programmers because the capital letters look like the humps on the back of a camel!
You learned what you can and can't put into a variable name, but what should you put into a variable name? While writing a computer program can be a lot of fun, looking over a program you wrote nine months ago, or a program someone else wrote can often be confusing. Writing clear and understandable code helps make your life easier as a programmer.
Names like t, n1 or p are short and require less typing, but they don't communicate the purpose of the variables. Even if it requires more typing, use descriptive names like score, playerName, or pricePerPound. Your programs will be a lot easier to understand if you do, and as a programmer, you should always strive to write understandable, readable code.
var s = 0;
var score = 0;
var n1 = "Jesse";
var playerOne = "Hope";
var p = 10;
var pricePerPound = 10;