I have an array setup like the following:
services = ['times', 'food', 'messages', 'share']
And I would like to be able to pass into services 'times' and have it return the next position in the array i.e. 'food'
nextPos = services.indexOf('times');
This is JS, but also valid in CoffeeScript. Note, though, that if used outside of CofeeScript, it's an ECMA5 addition, so won't work in older browsers (EDIT - as the comment says, this of course means IE <= 8).
nextPost = services.indexOf 'times' to make it more CS-esquevar isn't a legal token.