Index Explorer

Easy+15 XP

Mission Briefing

The Grand Archive stores data in massive numbered vaults. You need to retrieve the third scroll from a sealed collection.

The Concept: Array Basics

An Array is a special variable that can hold more than one value at a time. Each item in an array is stored in a numbered slot called an index, starting at 0.

  • arr[0] is the first item.
  • arr[1] is the second item.
  • arr[2] is the third item!

The Objective

Your function receives an array called data.

  1. Retrieve the third element from the array using bracket notation.
  2. Return that element.
  3. Remember that JavaScript arrays are zero-indexed!

01EXAMPLE 1

Inputdata = ["Red", "Green", "Blue", "Yellow"]
Output"Blue"

02EXAMPLE 2

Inputdata = [10, 20, 30, 40]
Output30

Constraints

  • Access the third element (index 2).
FundamentalsArrays
JavaScript
Loading...
3 Hidden

Input Arguments

data["A","B","C","D"]

Expected Output

C

Click RUN to test your solution