Array and array methods in TypeScript with example