Class 1/18 Flashcards

1
Q

What does the = (equals) operator do in JavaScript?

A

It assigns values

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

Which keyword is used to declare a variable in JavaScript?

A

var

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

Which characters is a JavaScript variable allowed to begin with?

A

$ and _

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

What are quotation marks used for in JavaScript?

A

Strings

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

What is the purpose of strings in JavaScript?

A

They are used for text values

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

What is the purpose of booleans in JavaScript?

A

Represented by true or false, data that can only have 1 of 2 values

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

What is the purpose of numbers in JavaScript?

A

Unsure

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

What does null mean in JavaScript?

A

Lack of any value, not undefined

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

What data types can object properties hold?

A

They can hold any data type

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

Describe the syntax (structure) of object-literals in JavaScript.

A

const person = {firstName:”John”, lastName:”Doe”, age:50, eyeColor:”blue”};

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

What is the principal use of arrays?

A

An array can hold many values under a single name, and you can access the values by referring to an index number.

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

Describe the syntax (structure) of array-literals in JavaScript.

A

const array_name = [item1, item2, …];

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

What number represents the first index of an array?

A

0

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

How can you access the last element of an array?

A

let fruit = fruits[fruits.length - 1];

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