Arrays - Reading Assignment

  1. What do arrays allow us to do?
    An array let’s you store multiple values in a single variable.
  2. What index should you use in order to access the first element in an array?
    (var)[0]
1 Like

1.What do arrays allow us to do? The Array object lets you store multiple values in a single variable. It stores a fixed-size sequential collection of elements of the same type.
2.What index should you use in order to access the first element in an array? The index at which to begin the search. Defaults to 0, i.e. the whole array will be searched. If the index is greater than or equal to the length of the array, -1 is returned.

1 Like
  1. What do arrays allow us to do?
    It’s a fixed size collection of data, or a list of data. The data can be of any type, like strings, numbers or booleans. An array has elements separated by commas in a square bracket structure like arr = [3, ‘cat’, false];. Arrays are objects that store of data, a sequential data structure. Arrays let us access element by the index of the array. Arrays can also be iterated.

  2. What index should you use in order to access the first element in an array?
    Index 0.

1 Like
  1. Arrays allow for the storing of multiple values in a single variable.
  2. The first element in an array belongs to the index 0.
1 Like
  1. organize collections of data in a indexed way
  2. arrays start always at index 0
1 Like
  1. What do arrays allow us to do?
    Store multiple values in a single variable.

  2. What index should you use in order to access the first element in an array?
    0

1 Like
  1. Arrays allow us to store multiple values in a single variable.
  2. Index: 0.
1 Like
  1. What do arrays allow us to do?
    Arrays give us the ability to store multiple values into a single variable.

  2. What index should you use in order to access the first element in an array?
    Elements start at 0, not 1, so you would need to access 0 to get to the first element.

1 Like
  1. Arrays allow us to hold several different values in a variable.
  2. In order to access the first element in an array, you must use 0 since the count begins with 0.
1 Like
  1. What do arrays allow us to do?

The Array object lets you store multiple values in a single variable.

  1. What index should you use in order to access the first element in an array?

[0] points to the first index.

1 Like
  1. What do arrays allow us to do?
  • To store more than one value of the same kind in a binding.
  1. What index should you use in order to access the first element in an array?
  • [0]
1 Like
  1. Arrays allow us to store multiple values in a single variable
  2. In an ordinal numerical system, the first element would have the index 0
1 Like
  1. Arrays allow us to store multiple values in a single variable.
  2. array[0]
1 Like

1.arrows allow us to store multiple values in a single variable
2. 0

1 Like
  1. What do arrays allow us to do?
    An array allows you to store multiple variables and assign them to a single variable.
  2. What index should you use in order to access the first element in an array?
    0, is the first index in reading/recalling the first element in an array.
1 Like

A: The Array object lets you store multiple values in a single variable it is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type

A: 0 The property represents the zero-based index of the match in the string

1 Like
  1. To store multiple values in a single variable.

  2. 0 will be the first element.

1 Like

Arrays provide a data type for storing sequence of values. The list of values are written between square brackets separated by commas.
They allow us to add a number of properties that hold function values.
They store multiple values, datas that usually are of the same type.

Array index starts from zero. So first element is in index 0 by default.

x[0]
1 Like
  1. Arrays can be used for several things. A good example for a use of an array is a grocery list. Lets say that in the grocery list you need to add celery, carrots, bananas and broccoli. How can you do that in code? Well there is two main ways. You can do it like:
    var groceryList = [“celery”, “carrots”, “bananas”, “broccoli” ]; or
    var groceryList = new Array(“celery”, “carrots”, “bananas”, “broccoli”);

  2. JavaScript counts a little different than how we normally do. For the grocery list instead of counting from 1-4 it reads it as 0-3. What does this mean?

var groceryList = ["celery", "carrots", "bananas", "broccoli" ];
                      ^           ^         ^           ^
                     #0          #1        #2           #3

So if your wanting to know what the first item on the grocery list is you would have to type console.log(groceryList[0]);

2 Likes

1- Arrays allow us to store multiple values of the same type under the same variable.
2- ‘binding name’[0]

1 Like