Rules: naming variables Flashcards

(8 cards)

1
Q

Variables must begin with:

A

Letter, dollar sign ($), or underscore (_)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Variables must NOT begin with:

A

A number (0 - 9)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

You cannot use __________ words or __________ words as variables.

A

You cannot use KEY words or RESERVED words as variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are key words?

A

Special words in the JavaScript language that tells the interpreter to do something.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are reserved words?

A

Words that may be used as key words in future versions of JavaScript.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Are variable names case sensitive?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the best practice for creating two different variables with the same spelling but different casing?

A

The best practice is not to do that because it is confusing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What do you do if the variable name is made up of more than one word?

A

Use camelCase: first word is in lower case only and capitalise the first letter of subsequent words.
Eg, thisVariableIsCamelCased

How well did you know this?
1
Not at all
2
3
4
5
Perfectly