JS Course 1: Fundamental 4 Flashcards
What is an Array?
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.
What’s an index number?
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]
What is an array literal?
An array literal is the simplest, easiest way to create a JavaScript Array.
Syntax:
const array_name = [item1, item2, …];
What is an Object?
Objects are similar to arrays, but have key differences. Objects use names to access its members instead of index numbers.
What is the “length” property?
The “length” property is an array property that returns the length of an array in numbers.
What are loops?
Loops are used in programming to perform a task multiple times over. Loops can be used for many, many things.
What is an infinite loop?
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.
What is a “break” statement?
When a break statement is reached in a loop, it stops all loop iterations and all code that comes after in the statement.
What is a “continue” statement?
When a “continue” statement is reached in a loop, it stops the loop iteration you’re currently in and continues onto the next iteration.
What are labels?
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.
What are automated tests? Why are they useful?
Automated tests can help you assure your code is working with the correct inputs and outputs, even before you start writing your code!