Rules: naming variables Flashcards
(8 cards)
Variables must begin with:
Letter, dollar sign ($), or underscore (_)
Variables must NOT begin with:
A number (0 - 9)
You cannot use __________ words or __________ words as variables.
You cannot use KEY words or RESERVED words as variables.
What are key words?
Special words in the JavaScript language that tells the interpreter to do something.
What are reserved words?
Words that may be used as key words in future versions of JavaScript.
Are variable names case sensitive?
Yes
What is the best practice for creating two different variables with the same spelling but different casing?
The best practice is not to do that because it is confusing.
What do you do if the variable name is made up of more than one word?
Use camelCase: first word is in lower case only and capitalise the first letter of subsequent words.
Eg, thisVariableIsCamelCased