JavaScript indexer and corresponding test.