Typescript Nested Functions In Javascript Interview