- Allows you to store a multiple of values in a single value. Its a collection of variables of the same type. e.g fruits (mango, apple,orange)
2.index 0 to access first element in an array.
2.index 0 to access first element in an array.
What do arrays allow us to do?
Arrays are used to store multible values of same data type in a single variable.
What index should you use in order to access the first element in an array?
Index 0.
What do arrays allow us to do?
Arrays allow us to group elements together bound to a single variable and perform a substantial variety of functions on them.
What index should you use in order to access the first element in an array?
[0]
1 What do arrays allow us to do?
You can store multiple values into a variable.
2 What index should you use in order to access the first element in an array?
IndexOf([0])
What do arrays allow us to do?
Store multiple values in a single variable.
What index should you use in order to access the first element in an array?
zero
An array lets us store several different variables in one variable name.
array[0] would be the first variable in the array.
Arrays are used to store a collection of variables of the same type.
They do by default start at zero, the first element is in index 0.
What do arrays allow us to do?
Arrays allow you to store multiple values in a single variable.
What index should you use in order to access the first element in an array?
indexOf()
1: Arrays allow us to store multiple values in a single variable. An array is used to store a collection of data.
2: Arrays starts counting at 0 so to get the first element we write [0], the second element is [1] and so forth.
Hi @keithra1948,
Q1
NoâŚthe first element in an array is at index 0, and so we access it as follows:
let array = [2, 4, 8, 16, 32];
console.log(array[0]); // => 2
indexOf()
is an array method which will return the index of the first element whose value matches the parameter. If no element exists with that value, thenâ-1
âis returned e.g.
let array = [2, 4, 8, 16, 32];
console.log(array.indexOf(2)); // => 0
console.log(array.indexOf(8)); // => 2
console.log(array.indexOf(7)); // => -1
I hope that makes things clearer for you
Just let us know if you have any questions.
1 - Arrays are variables capable of holding multiple values.
2- To access the first element you need to use 0.
1. What do arrays allow us to do?
They allow us to store multiple values in a single variable.
2. What index should you use in order to access the first element in an array?
Arrays start at 0.
It allows us to store multiple values in the same variable, we group them with these â[ ]â brackets, and place a comma next to each value to divide them. We can store any kind of values (strings, numbers and booleans) as long as they are of the same type. To simplify and array is a collection of data of the same type.
The index of the first element in every array is 0.
Hi @Ernest_SG,
Nice answers
In fact, an array can store values of different types, although you are right that they are predominantly used to store and manipulate values of the same type.
The key thing with arrays is that they store their values as a sequence: each element is an indexed value (an âindex/value pairâ).
1. What do arrays allow us to do?
They allow us to list multiple elements into one variable, i.e. we can create a collection of elements and store them in one variable.
2. What index should you use in order to access the first element in an array?
0
var christmasList = gifts [âNew Shedâ , âG.I.Joeâ , âWacky Inflatable Arm Flailing Tube Manâ]
1. What do arrays allow us to do?
Through the Array object it is possible to store multiple values in a single variable.
2. What index should you use in order to access the first element in an array?
index[0] - accesses the first element.