- Store multiple values in a variable.
- indexOf
-
arrows allow us to store more than one value/object in a variable.
-
index()
- The array object is used to store multiple values in a single variable. It is used to store a collection of data, but it is useful to look at it as a collection of variables of the same type.
- By default, the array index starts from zero. Thus to access the first element of an array I would need to index 0
- It allows us to store multiple values in a single variable.
- 0
2. What index should you use in order to access the first element in an array?
Quite close sir(s), but the index position to get the first element is always 0, arrayName[0]
Example:
//define an array of strings
var myArray = ["zero", "one", "two"]
//show in console the first index position (which is "zero")
console.log(myArray[0])
Hope you find this useful.
If you have any more questions, please let us know so we can help you!
Carlos Z.
- Arrays allow to store multiple variables of the same type in a single variable.
- The index of the first array element is [0].
-
What do arrays allow us to do?
to store multiple values in a single variable. It is used to store a collection of data, but it is useful to look at it as a collection of variables of the same type. -
What index should you use in order to access the first element in an array?
0
1.Array allows users to hold one or more than one value in a variable.
2.should use 0.
-
What do arrays allow us to do?
A: Arrays allow us to store multiple values in a single variable. -
What index should you use in order to access the first element in an array?
A: You should use the number “0” to access the first element in an array.
-
Arrays allow us to store multiple values in a single variable.
-
0
1. What do arrays allow us to do?
Arrays lets us store multiple values in a single variable. It is a sequential collection
of values, placed on as elements in an Array.
2. What index should you use in order to access the first element in an array?
We use a zero based index. We always start counting from zero in an Array.
Example: let age = [25, 56, 23, 49, 86]
age[0] ==> //equals to 25 (the 1st element of the age array);
- Arrays allow us to store multiple values in a single variable and provide many useful methods to work with.
- In order to access the first element in an array we should use index 0.
Q1. What do Arrays allow us to do?
A. They allow us to store more than one value in a single variable.
Q2. What index should you use in order to access the first element in an Array?
A. 0
-
Arrays let us store “sequential collection of elements of the same type”
-
First element in array is indexed with 0.
- What do arrays allow us to do?
- An Array is a data type that allows us to store sequences of values
- What index should you use in order to access the first element in an array?
- Arrays count from the first index of 0 then onto 1 then 2…so on and so forth. To access the first element the index 0 should be called.
Javascript Arrays can store different types of elements as well.
For example -
var myArray = [
"boy", //first element is a string
34, ////second element is a number
{ name: "testname", age : 45 } //third element is an object
]
Happy Learning!
got it, thank you
- Arrays allow us to store data in one variable. It is usually used to store different values of one type in one variable, but it is possible to store any kind of values in one variable.
- To access the first element, [0] index should be used.
What do arrays allow us to do?
The Array object lets you store multiple values in a single variable
Example:
var fruits = [ “apple”, “orange”, “mango” ];
What index should you use in order to access the first element in an array?
alert(fruits[0]) - This assumes that the first element in the array is always has an index of 0
1.What do arrays allow us to do?
You can store multiple values under the same variable.
- What index should you use in order to access the first element in an array?
[0]