Module 09 - Arrays Flashcards
What is array idioms?
A common or accepting way of expressing a particular idea or pattern in a code
What happens when you initialize an array?
You define its size and provide initial values for its elements
What is an array?
An array is like a list where you can store multiple items of the same type, such as numbers or strings, under a single name.
Values in an array are ordered in sequence. T or F
True
Each value stored in an array is called ‘component’. T or F
False. It’s element
Does every array have a name?
Yes
Each element is accessed through a unique index. T or F
True
Index is not a whole number starting from 0
False
What is a button variable?
Refers to a bundle of information within a single variable
What is dot notation?
To access properties of an object
How do you use dot notation?
Use the name of the variable, followed by a dot, followed by a field name
Example: text(button.label, textX, textY);
When counting elements in an array, what do you start with?
Always starts at 0 through 1
What does updating an array mean?
Means to modify the values stored in an array
How do you change the value of an element in an array?
You specify it
Example: let colour = [“brown”, white”, “blue”, “green”, “red”];
CHANGE INSTRUCT: colour[2] = “pink”
NOW: let colour = [“brown”, “white”, “pink”, “green”, “red”];