Typescript Get Value From Array Javascript Length Validation Vs Verification