Implement `$.prototype.index`

It seems more logical to me to write the conditions in this order:

```javascript
if (arguments.length === 0) ...
else if (typeof selectorOrNeedle === 'string') ...
else ...
```

This way we ensure the first argument is present before checking its type. It doesn't make a difference to the computer, of course, but it may assist human readers.