Hey folks! I’m working on this kata (https://www.codewars.com/kata/element-equals-its-index/train/javascript) and here is my attempt so far…

```
function indexEqualsValue(a) {
let currentLow = -1;
let helperFunction = (start, stop, currentLow, a) => {
if (start > stop) {
return currentLow;
}
let mid = Math.floor(start - ((start- stop) / 2));
if (a[mid] == mid) {
currentLow = mid;
helperFunction(start, mid-1, currentLow, a);
} else if (a[mid] > mid) {
helperFunction(start, mid-1, currentLow, a);
} else {
helperFunction(mid+1, stop, currentLow, a);
}
}
return helperFunction(0, a.length -1, currentLow, a);
}
```

I think that ultimately a recrusive function is going to yield the best runtime here but I need to get the function working first!

The helperFunction is included because the kata has one parameter passing in and I need to keep track of the start/stop and the lowest a[index] == a match… When I debug, for the arrays with an answer other than -1, my recursion has the currentLow set to the current index/value but when it completes the recursion, I always end up returning undefined after it goes through the base case. Thoughts?