javaScript Flashcards

(27 cards)

1
Q

What is the purpose of variables?

A

information to be referenced or manipulated later and a way of labeling data.

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 and the “word”

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

= means assign

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

number, letters, underscore

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

they must be spelt and capitalized when referenced (camel case)

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

let’s you work with a series of characters

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

can be assigned as a value to a variable

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

a true or false value the can be used later in some action

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

assigned

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

by assign it a different value with a function

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

null is a assigned value & undefined has no value

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 information becoming confusing and debugging

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, boolean, number, null and 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

the return values are always based on the operands values before the operation

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

What is string concatenation?

A

sticking two strings together

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

The + operator is used to perform both addition and string concatenation

17
Q

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

18
Q

What does the += “plus-equals” operator do?

A

+= operator is used to concatenate strings or add numbers

19
Q

What are objects used for?

A

store collection of related data (model)

20
Q

What are object properties?

A

property is an association between a name (key) and a value

21
Q

Describe object literal notation.

A

= { firstName: Jim; lastName: Smith; age: 18; }

22
Q

How do you remove a property from an object?

A

the delete operator

23
Q

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

A

the dot method

or bracket notation

24
Q

What are arrays used for?

A

lets you store multiple values in a single variable. It stores a fixed-size sequential collection of elements of the same type

25
Describe array literal notation.
[ 1, 2, 3, 4 ]
26
How are arrays different from "plain" objects?
Arrays store an ordered list of data. Objects store an unordered list. Objects store information representing a thing. Arrays data can be accessed by index number. Objects represent “things” with characteristics (aka properties), while arrays create and store lists of data in a single variable.
27
What number represents the first index of an array?
Zero is the start of an array