Typescript Change Index In Array Javascript Length Method Ruby