Typescript Get Last Index Of Array Javascript Methods For Querying