JS Course 1: Fundamental 4 Flashcards

1
Q

What is an Array?

A

An array is an ordered collection of items that may be strings, numbers, or other things. It is a special variable that can hold more than one value.

They are considered “objects,” but they are not by their nature. Arrays use index numbers to access its members.

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

What’s an index number?

A

An index number is used to specify the elements of an array or string. It starts at the number 0 for the first character left-to-right.

Example accessing index number 0 of an array:
array_name[0]

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

What is an array literal?

A

An array literal is the simplest, easiest way to create a JavaScript Array.

Syntax:
const array_name = [item1, item2, …];

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

What is an Object?

A

Objects are similar to arrays, but have key differences. Objects use names to access its members instead of index numbers.

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

What is the “length” property?

A

The “length” property is an array property that returns the length of an array in numbers.

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

What are loops?

A

Loops are used in programming to perform a task multiple times over. Loops can be used for many, many things.

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

What is an infinite loop?

A

An infinite loop refers to a loop that continues running code forever, or until the browser/program/computer crashes. It’s important to learn how to avoid these by having set starts, growths/decays, and ends.

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

What is a “break” statement?

A

When a break statement is reached in a loop, it stops all loop iterations and all code that comes after in the statement.

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

What is a “continue” statement?

A

When a “continue” statement is reached in a loop, it stops the loop iteration you’re currently in and continues onto the next iteration.

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

What are labels?

A

Labels are ways to break out of multiple loops when “continue” or “break” doesn’t work for your situation (like nested loops.) Labels are identifiers that precede a colon right before a loop.

Labels allow you to transport outside of the loops you’re in to a different workflow. Though, you can’t use labels to transport anywhere in your code, thought it’s technically possible.

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

What are automated tests? Why are they useful?

A

Automated tests can help you assure your code is working with the correct inputs and outputs, even before you start writing your code!

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