# Iteration Help Question

**URL:** https://forum.code.org/t/iteration-help-question/40604
**Category:** Coding and Debugging Help
**Created:** [March 26, 2025, 5:27pm UTC](https://forum.code.org/t/iteration-help-question/40604 "2025-03-26T17:27:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jmcdonald](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jmcdonald](https://forum.code.org/u/jmcdonald)
#### Post date: [March 26, 2025, 5:27pm UTC](https://forum.code.org/t/iteration-help-question/40604/1 "2025-03-26T17:27:20Z")

</div>

Does this function include iteration? It does not have a while or for loop. But has an "implicit Loop. Would this earn credit for having iteration on the create task?

function hadamardProduct(v1, v2) {

```
   if (v1.length != v2.length) {

         throw new Error(

               "Arguments to `hadamardProduct` must be of the same length."

        );

  }

 // Implicitly loops through the array

return v1.map(function(v, i){return v * v2[i];});

```

}

---

<div class="post-metadata">

### Author: ![ironswordX](https://avatars.discourse-cdn.com/v4/letter/i/5f9b8f/32.png) [@ironswordX](https://forum.code.org/u/ironswordX)
#### Post date: [March 26, 2025, 5:43pm UTC](https://forum.code.org/t/iteration-help-question/40604/2 "2025-03-26T17:43:03Z")

</div>

Hey there! Welcome to the forums.

This code definitely does contain a loop, which is the `.map` call. With `.map`, you have a function that is called for each item of an array (in order). Using `.map` on an array is, at its core, the same thing as iterating through an array with a for loop.

If you need any more explanation, feel free to ask!

---

<div class="post-metadata">

### Author: ![madeline\_r\_burton](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/madeline_r_burton/32/5037_2.png) [@madeline\_r\_burton](https://forum.code.org/u/madeline_r_burton)
#### Post date: [March 27, 2025, 3:23am UTC](https://forum.code.org/t/iteration-help-question/40604/3 "2025-03-27T03:23:58Z")

</div>

I think the important part here is that the student is able to explain how the code leverages iteration. If there is a visible for/while loop, that is easier to articulate for most students than describing how a map function does in fact use iteration. That said, the “behind the scenes” loop of map should be viable for any student that can articulate the abstraction.
