# Uncaught e.findIdx is not a function error

**URL:** https://forum.makecode.com/t/uncaught-e-findidx-is-not-a-function-error/23788
**Category:** Help
**Created:** [October 30, 2023, 5:20pm UTC](https://forum.makecode.com/t/uncaught-e-findidx-is-not-a-function-error/23788 "2023-10-30T17:20:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Comrade-Bacon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/comrade-bacon/32/11509_2.png) [@Comrade-Bacon](https://forum.makecode.com/u/Comrade-Bacon)
#### Post date: [October 30, 2023, 5:20pm UTC](https://forum.makecode.com/t/uncaught-e-findidx-is-not-a-function-error/23788/1 "2023-10-30T17:20:39Z")

</div>

I am working on a game in VS Code, I ran into this error and don’t know what it means or how to resolve it.

VS Code error:  
Uncaught e.findIdx is not a function  
at lvl1 (main.ts:105:1)  
at inline (main.ts:54:57)  
at runButtonEvents (pxt\_modules/game/controllerbutton.ts:237:9)  
at inline (pxt\_modules/game/controllerbutton.ts:266:45)  
at inline (pxt\_modules/base/eventcontext.ts:32:59)

Make Code Website error:  
e.findIdx is not a function  
at lvl1 (line 118)  
at inline (line 57)  
at inline (line 6)

Code of interest:  
let enemys: any =   
let enemyNumber: number  
for (let i: number = 0; i \< 3; i++) {  
// enemy setup  
enemyNumber = i  
enemys[enemyNumber] = sprites.create(assets.image`Basic Enemy`, SpriteKind.Enemy)  
enemys[enemyNumber].vx = -30

```
    // enemy movment setup
    game.onUpdateInterval(200, function () { // evry 0.2 sec          
        if (enemys[enemyNumber].vx == 30) { // if the player is traveling right
            if (!(tiles.tileAtLocationIsWall(enemys[enemyNumber].tilemapLocation().getNeighboringLocation(CollisionDirection.Right).getNeighboringLocation(CollisionDirection.Bottom)))) { // if the tile to the below and to the right of the sprite is not a wall
                enemys[enemyNumber].vx = -30 // make the sprite turn the other direction
            }
        } else {
            if (!(tiles.tileAtLocationIsWall(enemys[enemyNumber].tilemapLocation().getNeighboringLocation(CollisionDirection.Left).getNeighboringLocation(CollisionDirection.Bottom)))) { // if the tile to the below and to the right of the sprite is not a wall
                enemys[enemyNumber].vx = 30 // make the sprite turn the other direction
            }
        }
    })
}

tiles.placeOnTile(enemys[1], tiles.getTileLocation(10, 14))
tiles.placeOnTile(enemys[2], tiles.getTileLocation(20, 14))
tiles.placeOnTile(enemys[3], tiles.getTileLocation(29, 11))

```

The Git-Hub repo and branch I am working on can be found [Here](https://github.com/Comrade-Bacon/TSA/tree/Code-(Colton))
