javascript Flashcards

1
Q

What is the purpose of variables?

A

hold a value

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

How do you declare a variable?

A

var

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

How do you initialize (assign a value to) a variable?

A

=

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

What characters are allowed in variable names?

A

identifier must start with a letter, underscore ( _ ), or dollar sign ( $ ). Subsequent characters can also be digits ( 0 – 9 ).

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

What does it mean to say that variable names are “case sensitive”?

A

upper and lower case affects it

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

What is the purpose of a string?

A

useful for holding data as text

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

What is the purpose of a number?

A

primitive wrapper object used to represent and manipulate numbers

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

What is the purpose of a boolean?

A

true or false

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

What does the = operator mean in JavaScript?

A

assignment

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

How do you update the value of a variable?

A

FIND THE ANSWER

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

What is the difference between null and undefined?

A

undefined is a type, whereas null an object.

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

Why is it a good habit to include “labels” when you log values to the browser console?

A

to keep track of where you are

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

Give five examples of JavaScript primitives

A

string, number, bigint, boolean, symbol, undefined

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

What data type is returned by an arithmetic operation?

A

FIND THE ANSWER

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

What is string concatenation?

A

method concatenates the string arguments to the calling string and returns a new string.

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

What purpose(s) does the + plus operator serve in JavaScript?

A

addition or string concatenation

17
Q

What data type is returned by comparing two values (, ===, etc)?

A

find answer

18
Q

What are objects used for?

A

used to store keyed collections of various data and more complex entities

19
Q

What are object properties?

A

attributes linked with the property,

20
Q

Describe object literal notation.

A

An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}

21
Q

How do you remove a property from an object?

A

delete operator

22
Q

What are the two ways to get or update the value of a property?

A

find answer

23
Q

What are arrays used for?

A

store multiple values in a single variable

24
Q

Describe array literal notation.

A

list of expressions, each of which represents an array element, enclosed in a pair of square brackets ‘ [ ]

25
Q

How are arrays different from “plain” objects?

A

ordered list

26
Q

What number represents the first index of an array?

A

0

27
Q

What is the length property of an array?

A

shows how many entries

28
Q

How do you calculate the last index of an array?

A

array.length-1