# Summit's Gate - Javascript Help

**URL:** <https://discourse.codecombat.com/t/summits-gate-javascript-help/28176>\
**Category:** Level Help\
**Created:** [March 29, 2021, 5:56pm UTC](https://discourse.codecombat.com/t/summits-gate-javascript-help/28176 "2021-03-29T17:56:59Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![xython](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xython/32/7269_2.png) [@xython](https://discourse.codecombat.com/u/xython)\
**Post date:** [March 29, 2021, 10:06pm UTC](https://discourse.codecombat.com/t/summits-gate-javascript-help/28176/3 "2021-03-29T22:06:14Z")

</div>

You hero is doing nothing because of typo:

```python
function heroAction() {
// code
        if (hero.distanceTo("enemy" > 29)) //code

```

preserving your code and with the simplest for the hero

```python
    var enemy = hero.findNearestEnemy();
    if (enemy) hero.attack(enemy) ;

```

you can reach the Inner Sanctum

 ![изображение](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/8/6/8678f8ed932f0ee738666ab3f185b682f69a81aa.jpeg)  
but you lose so many soldiers…  
didn’t try but i think you need only paladins and archers, i passed the level with a free hero, without summoning any and without losing any unit.  
See [Jenny's method - stacking while true loops: Summit Gate](http://discourse.codecombat.com/t/jennys-method-stacking-while-true-loops-summit-gate/25207)? how the level can be divided into several while true loops

Has anybody tested the new brew ability?

---

_[View the full topic](https://discourse.codecombat.com/t/summits-gate-javascript-help/28176)._
