Typescript Reduce Function In Js W3schools