I'm currently using the function below to look up values in my array. it works great. However i want to modify it to start from the end and get the last value that matches. Please help

```
Array.prototype.indexOfObj = function (key, value) {
for (var i = 0; i < this.length;)
    if (this[i++][key] === value) return --i
return -1
}
myArr.indexOfObject("key", "value");

```