# Assessment wanted for Arrays skill test - 9.6.23

**URL:** https://discourse.mozilla.org/t/assessment-wanted-for-arrays-skill-test-9-6-23/122465
**Category:** Learn
**Created:** [September 7, 2023, 3:47am UTC](https://discourse.mozilla.org/t/assessment-wanted-for-arrays-skill-test-9-6-23/122465 "2023-09-07T03:47:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jt\_1](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/jt_1/32/62504_2.png) [@jt\_1](https://discourse.mozilla.org/u/jt_1)
#### Post date: [September 7, 2023, 3:47am UTC](https://discourse.mozilla.org/t/assessment-wanted-for-arrays-skill-test-9-6-23/122465/1 "2023-09-07T03:47:16Z")

</div>

Hi everyone!

I’m requesting a view of my solutions for the **[Test your skills: Arrays](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Test_your_skills:_Arrays)** exercise.

**CodePen Links:**  
[Arrays 1](https://codepen.io/jt_1/pen/QWzGMzQ)  
[Arrays 2](https://codepen.io/jt_1/pen/gOZgpWx)  
[Arrays 3](https://codepen.io/jt_1/pen/OJrWVmO)  
[Arrays 4](https://codepen.io/jt_1/pen/BavpNRJ)

Feedback is appreciated, thank you!

---

<div class="post-metadata">

### Author: ![mikoMK](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/mikomk/32/50456_2.png) [@mikoMK](https://discourse.mozilla.org/u/mikoMK)
#### Post date: [September 10, 2023, 12:48pm UTC](https://discourse.mozilla.org/t/assessment-wanted-for-arrays-skill-test-9-6-23/122465/2 "2023-09-10T12:48:52Z")

</div>

Hi again @jt_1

Good work! Here are my comments:

- General note: When using an online editor, you should also include the HTML and CSS. All tasks have a link at the end with the whole downloadable code (HTML, CSS, JS). This makes testing and changing things easier for us.
- Tasks 1 + 2: ✅ Correct
- Task 3: ⚠ Mostly correct.
  - You should use `const` on the loop item (`for (const item of myArray) {}`). This also reminds us that `item` is just a temporary variable inside the loop.
  - You correctly created the new elements (`itemIndex`) in the loop, but they are immediately discarded instead of replacing the existing elements in the loop. Hint: Assign the new element at the correct index of the array. It may be easier to use another type of loop like [forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) where you have access to the `index` directly in the callback function.

- Task 4: ⚠ Mostly correct. `birds.slice(eagleIndex + 1)` doesn’t return the array without “Eagles” as asked in the first part of the task. Try `console.log()` that part to see what you are returning. Hint: Have a look at [splice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice).

If my explanations are unclear, just ask. 🙂

See you,  
Michael

---

<div class="post-metadata">

### Author: ![jt\_1](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/jt_1/32/62504_2.png) [@jt\_1](https://discourse.mozilla.org/u/jt_1)
#### Post date: [September 13, 2023, 12:48am UTC](https://discourse.mozilla.org/t/assessment-wanted-for-arrays-skill-test-9-6-23/122465/3 "2023-09-13T00:48:00Z")

</div>

Thank you @mikoMK! 🙂

I’ve re-worked 3 and 4 based on your feedback. I’ll be sure to implement the HTML, CSS as well in future posts!

  

**Arrays 3 (new):**  
[https://codepen.io/jt\_1/pen/poqwooZ](https://codepen.io/jt_1/pen/poqwooZ)

**Arrays 4 (new):**  
[https://codepen.io/jt\_1/pen/KKbqKKe](https://codepen.io/jt_1/pen/KKbqKKe)

  

Using **`forEach`** was a little intimidating at first because it’s not really covered in [JavaScript First Steps](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps) but looks like the concept will be explained more in the JavaScript Building Blocks section. Anyway, I was able to get something working with it, yay!

Let me know your thoughts.

  

By the way - on the original solution for Arrays 4, I put **`.slice`** but actually meant **`.splice`**. Whoops lol.

I have no idea what **`.slice`** does but when I tested it seemed to show the results needed. (Old solution for reference - [https://codepen.io/jt\_1/pen/BavpNRJ](https://codepen.io/jt_1/pen/BavpNRJ))

Regardless, I still like my new solution better on the 2nd attempt! 🙂

---

<div class="post-metadata">

### Author: ![mikoMK](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/mikomk/32/50456_2.png) [@mikoMK](https://discourse.mozilla.org/u/mikoMK)
#### Post date: [September 13, 2023, 9:57pm UTC](https://discourse.mozilla.org/t/assessment-wanted-for-arrays-skill-test-9-6-23/122465/4 "2023-09-13T21:57:27Z")

</div>

Neato! Great improvements.

By the way using `filter()` in “Array 4” like you did in your first version was fine. But as usual with JS there are multiple ways to solve a problem. 😉

> [@jt\_1](#):
>
> Using **`forEach`** was a little intimidating at first

Understandable. On the plus side there are several methods that operate on every elements of an array that are much easier to understand now that you know how `forEach()` works. You already used `filter()` and another one I frequently use is `map()`.

---

<div class="post-metadata">

### Author: ![jt\_1](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/jt_1/32/62504_2.png) [@jt\_1](https://discourse.mozilla.org/u/jt_1)
#### Post date: [September 13, 2023, 11:43pm UTC](https://discourse.mozilla.org/t/assessment-wanted-for-arrays-skill-test-9-6-23/122465/5 "2023-09-13T23:43:55Z")

</div>

Ok got it and thank you so much again for your helpful feedback on this!
