Question: If intervalIsClear is true, the hoveredItemIndex is picking up the index of the LI element fine.

If intervalIsClear is false, it is hoveredItemIndex is declared inside a setTimeout(), but is returning -1. Why can't it find the index once it is wrapped in a setTimeout()?

```
function()
                {
                    if (intervalIsClear == true){

                        hoveredItemIndex = $('.menu li').index(this);
                        changeToHoverText();
                    } else {
                        hello = setTimeout(function(){
                            hoveredItemIndex = $('.menu li').index(this);
                            alert (hoveredItemIndex);
                            changeToHoverText();
                        },500);
                    }
                }

```

Answer: 
It is because when the function is executed a callback for `setTimeout` the execution context of the method is changed. Which means that the `this` variable inside and outside the `setTimeout` callback points to different objects.

Use [$.proxy](http://api.jquery.com/jQuery.proxy/) to manually assign the execution context of a callback method

```
function () {
    if (intervalIsClear == true) {

        hoveredItemIndex = $('.menu li').index(this);
        changeToHoverText();
    } else {
        hello = setTimeout($.proxy(function() {
            hoveredItemIndex = $('.menu li').index(this);
            alert(hoveredItemIndex);
            changeToHoverText();
        }, this), 500);
    }
}

```
`this` in the callback of `setTimeout` is not same with outside.

You need to do with:

```
                var that = this;
                hello = setTimeout(function(){
                    hoveredItemIndex = $('.menu li').index(that);
                    alert (hoveredItemIndex);
                    changeToHoverText();
                },500);

```