# How do you determine what type of enemies is an array

**URL:** <https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706>\
**Category:** Uncategorized\
**Created:** [August 16, 2015, 6:46pm UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706 "2015-08-16T18:46:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [August 16, 2015, 6:46pm UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/1 "2015-08-16T18:46:03Z")

</div>

I am trying to find a shaman in an array of enemies and I forgot how to do could someone please tell me how to do this

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [August 16, 2015, 11:15pm UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/2 "2015-08-16T23:15:55Z")

</div>

I believe you can use `enemy.type`. For example:

```python
if enemy.type == "shaman":
    # do stuff

```

---

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [August 23, 2015, 1:36am UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/3 "2015-08-23T01:36:57Z")

</div>

I mean within an array

---

<div class="post-metadata">

**Author:** ![GundericusTheMighty](https://avatars.discourse-cdn.com/v4/letter/g/bbce88/32.png) [@GundericusTheMighty](https://discourse.codecombat.com/u/GundericusTheMighty)\
**Post date:** [August 23, 2015, 2:29am UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/4 "2015-08-23T02:29:20Z")

</div>

Try `self.findByType("shaman")`.

---

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [August 24, 2015, 1:03am UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/5 "2015-08-24T01:03:40Z")

</div>

I know that, for my strategy to work in need to find the shamens(shamen?) in the array

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [August 24, 2015, 3:21am UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/6 "2015-08-24T03:21:38Z")

</div>

I’m interpreting your question in a couple different ways:

1: You want to find shamans inside an array of enemies:

```python

var enemies = this.findEnemies();
for (enemyIndex = 1;,enemyIndex < enemies.length;,enemyIndex++) {
    if (enemies[enemyIndex].type == "shaman") {
        // do stuff

```

2: You want to make an array of shamans from an array of enemies:

Simply use `this.findByType("shaman")`.

---

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [August 25, 2015, 10:27pm UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/7 "2015-08-25T22:27:20Z")

</div>

I was intending to do the first one and I need this in Js please

---

<div class="post-metadata">

**Author:** ![Chirpizard](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chirpizard/32/2952_2.png) [@Chirpizard](https://discourse.codecombat.com/u/Chirpizard)\
**Post date:** [August 25, 2015, 10:51pm UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/8 "2015-08-25T22:51:23Z")

</div>

Chronist’s example is in JS.

---

<div class="post-metadata">

**Author:** ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)\
**Post date:** [August 25, 2015, 10:55pm UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/9 "2015-08-25T22:55:42Z")

</div>

So it is. Is there something I am missing?

---

<div class="post-metadata">

**Author:** ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)\
**Post date:** [August 26, 2015, 9:16pm UTC](https://discourse.codecombat.com/t/how-do-you-determine-what-type-of-enemies-is-an-array/4706/10 "2015-08-26T21:16:51Z")

</div>

hmm ithough it had no semi colons so i though it was python but it appears that i was mistaken
