Typescript Check For Empty Array Javascript Methods And Functions