JS Basics Flashcards

1
Q

What are the primitive data types?

A

Numbers, Strings, Boolean Values

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

What are the composite data types?

A

Objects, Functions, Arrays, JavaScript Object Literals

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

What is a data type?

A

A general term to describe categories of values that a program or programming language can make use of.

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

What is the Number Data Type?

A

A numeric value

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

What is the String Data Type?

A

A sequence of valid characters usually used for text surrounded by quotes.

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

What is the Boolean Data Type?

A

A true or false value.

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

What is a switch statement?

A

Allows you to set a number of options (cases) and check an expression to see if it matches any of them. If no match is found it returns the default action.

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

What does && do?

A

AND, Returns true if both conditions are true.

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

What does || do?

A

OR, Returns true if one or both of the conditions are true.

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

What is a heterogeneous array?

A

An array with mixed data types.

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

What is a jagged array?

A

Jagged arrays are when you have 2 dimensional arrays of varying length

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

What is a 2 dimensional/multidimensional array?

A

An array that has an array inside of it

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

What type of object syntax is: var obj = { } ?

A

Object Literal Syntax

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

What type of object syntax is: var obj = new Object( ); ?

A

Object Constructor Syntax

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

What is a property?

A

A variable associated with an object

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

What is a method?

A

A function (action) associated with an object

17
Q

What does myObj.hasOwnProperty(“name”); do?

A

Checks to see if the object myObj has a property called name and returns true if it does.

18
Q

What does for(var myProp in places){} do?

A

Runs the code for all properties in the object places all at once.

19
Q

What does for(var x in blank) {
console.log(blank[x]);
} do?

A

It will print all the property values for the object blank.

20
Q

What is a ternary operator?

A

A ternary operator is often used as a shortcut for the if statement.

21
Q

What is the syntax of the ternary operator?

A

condition ? expression1 : expression2

22
Q

What does the ? and : stand for in a ternary operator?

A

the ? creates the condition followed by the expression to run if the condition is true. The : creates the second condition to run if it’s false (else{})

23
Q

What is a function?

A

A body of code that can be called by other code or by itself, or a variable that refers to the function. (a verb in programming).

When a function is called, arguments are passed to the function as input, and the function can optionally return an output. A function is also an object.