Home / Advanced JavaScript Tutorials / Variable and expression shortcuts |
CodingForums Jump to...
- CSS Drive
- PHP Resources - Hotels & Vacations - Bad credit cards - JavaScript Menus |
Probably the most frequently done thing in programming is declaring variables. Whatever you do, however you do it, you can't live without these "containers". Most of us JavaScripters are probably used to declaring variables by using the "var" keyword in front of each variable we wish to declare, like this: var Sam There is actually a quicker way when it comes to declaring multiple variables, and it looks like this: var Sam, Joe, Bob, Mary Simply use "var" once, followed by the names of the variables, each separated by a semicolon. You can also choose to initialize some/all of the variables upon declaration this way: var Sam="10yr", Joe="30yr", Bob="15yr", Mary="21yr" -Tutorial introduction |
http://javascriptkit.com |