Typescript Find Element In Array Javascript Function