Typescript Sum Of Array Using Pointer