Typescript Loop Through Object Attributes Javascript Array Functions