# How to find the index of a specific element

**URL:** https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285
**Category:** Help
**Created:** [August 6, 2026, 5:14pm UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285 "2026-08-06T17:14:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/35216_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)
#### Post date: [August 6, 2026, 5:14pm UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285/1 "2026-08-06T17:14:10Z")

</div>

For example when you have an array of images you want for your sprite and you use it for a sprite’s image, is there a way to have an if statement checking which index is used, and if that index is used, make the sprite have different properties?

---

<div class="post-metadata">

### Author: ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)
#### Post date: [August 6, 2026, 5:31pm UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285/2 "2026-08-06T17:31:44Z")

</div>

![markup_1000008322](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/0/7/0747f92f5d1872c5b3bb99a411a8a465ca789ce7.png)

Its at the bottom of the Array category!

---

<div class="post-metadata">

### Author: ![CodaKnight](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codaknight/32/33491_2.png) [@CodaKnight](https://forum.makecode.com/u/CodaKnight)
#### Post date: [August 6, 2026, 5:32pm UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285/3 "2026-08-06T17:32:07Z")

</div>

Block:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/5/8/5876f6b2b40de225ff8c97768e12e0d5e1938afd.png)

---

<div class="post-metadata">

### Author: ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/35216_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)
#### Post date: [August 6, 2026, 7:13pm UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285/4 "2026-08-06T19:13:02Z")

</div>

stupid stupid stupid

I forgot to add the image block sorry

---

<div class="post-metadata">

### Author: ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)
#### Post date: [August 6, 2026, 7:21pm UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285/5 "2026-08-06T19:21:39Z")

</div>

I don’t think the builtin blocks will work.

> **[Image Index Search](https://arcade.makecode.com/49321-34592-22952-47007)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

You would need to do it this way in JavaScript:

```typescript
let index: number = -1
images2.find((value: Image, i: number) => {
    if (value.equals(needle)) {
        index = i
        return true
    }
    return false
})
game.splash(index)

```

@Sarge or @WoofWoof , I’ve forgotten: Does either of your extensions includes the `find()` function?

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [August 7, 2026, 2:14am UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285/6 "2026-08-07T02:14:01Z")

</div>

Looks like @Sarge’s does!

 ![IMG_3678](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/9/99388670572f4b6c66577980ddf89eb8d5ac35a5.jpeg)  
You can find it by putting this link in the extensions search bar!  
[https://github.com/sargedev/betterarrays](https://github.com/sargedev/betterarrays)

---

<div class="post-metadata">

### Author: ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)
#### Post date: [August 7, 2026, 2:36am UTC](https://forum.makecode.com/t/how-to-find-the-index-of-a-specific-element/45285/7 "2026-08-07T02:36:20Z")

</div>

oh right, images are pointers kinda
