Variables, Declarations, Initializations, and DataTypes Flashcards

1
Q

Name 3 variable keywords.

A

var
let
const

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

What is a variable?

A

A variable is a named container used for storing data or values.

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

Write an example of a variable.

A

let fruit = ‘apple’;

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

Is var hello = ‘hello’; the same as var Hello = ‘hello’; ?

A

Nope! Variable naming is case sensitive.

var hello is a different variable than var Hello.

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

When do we use the keyword ‘const’?

A

We use the keyword ‘const’ to create a variable of which we don’t want the value to be able to be changed or altered at any given time.

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

Time to deconstruct a variable. For example: let b = 1;

What are the names of the 4 components that create a variable?

A

1 - Keyword
2 - Variable Name
3 - Assignment Operator
4 - Variable Value

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

What does the left hand side of a variable refer to?

let x ;

A

The left hand side of a variable is called the ‘declaration’. It is simply the variable keyword and the variable name.

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

What does the right hand side of a variable refer to?

x = 10 ;

A

The right hand side of a variable is called the ‘initialization’. It includes the variable name, assignment operator, and the value of the variable.

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

Name the 6 basic data types in JavaScript we covered in class and write an example for each of them.

A
  1. Boolean: let boolean = true;
  2. Number: let num = 14;
  3. String: let string = ‘Hello’;
  4. Null: let nothing = null;
  5. Undefined: let undef = undefined;
  6. Object: let food = [‘pizza’, ‘shrimp’];
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does JavaScript use to join strings?

A

In JavaScript, we can use concatenation to join strings together to build sentences.

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

Which method uppercases all the letters in a string?

A

Methods are tools that allow us to manipulate data.

myName.toUpperCase( ) ;

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

How do you make a directory through the command line?

A

mkdir

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

How do you check what folders you can access in the command line?

A

ls (for mac)

dir (for pc)

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

How do you change directories in the command line?

A

cd

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

How do you back up one directory in the command line?

A

cd ..

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