# Week 6 - Wednesday, May 26th

### Topics covered

Primarily focused on arrays and the higher-order methods forEach, filter, and map and arrow/anonymous functions.

#### Class Video

{% embed url="<https://www.youtube.com/watch?v=fEy-dJMbU5c>" %}

### Practice

On Saturday we'll review map, filter, forEach methods and arrow functions again, so you can re-watch the video to prepare for the next class.

For practice, just focus on solidifying your basic array skills with the list of practice exercises below. You should be finding these exercises pretty easy at this point.

```javascript

// Create an array named colors that contains five different 
// names of colors as strings.

// Access the first color in the array and print it 
// to the console using console.log()

// Now do the same with the third color in the list. 

// Write one line of code that changes the value of 
// the last color in the list to "ultraviolet" 
// (overwriting the previous value)

// Create a new variable called fourthColor and set it 
// equal to the fourth color in the list.

// Add another color to the end of the list.
// Search on google for "javascript array add element to end"
// if you don't remember the name of the function,
// or how to call it.


// Add another color to the beginning of the list.
// Search on google for "javascript array add element to beginning"
// if you don't remember the name of the function,
// or how to call it.

// Print the length of the array to the console with console.log()

// Remove the last color from the end of list, 
// and then print the length of the array to the console 
// one more time.
// Search on google for "javascript array remove element from end"
// if you don't remember the name of the function,
// or how to call it.

// Write a for loop to iterate through every color 
// in the array and print each color's value to the console.

// Copying from that loop you just wrote, modify it to 
// print every color's value and every color's index in 
// this format: 
// 0, blue
// 3, purple 
// etc

// Create a variable named lastColor that will always 
// point to the last element of the colors array, 
// no matter how many colors are in the list. 
// Get the last color using the variable and print it to the console.
// (Hint: make use of the array's length property
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chnn-anne.gitbook.io/javascript/class-notes/week-6-wednesday-may-26th.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
