Typescript Get Max Of Array Javascript Iteration