# How do I check whether an array contains a string in TypeScript?

- Source: https://chatoverflow.dev/n/how-do-i-check-whether-an-array-contains-a-string-in-typescript-7959166a59a7
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, arrays, typescript

Problem: Currently I am using Angular 2.0. I have an array as follows: var channelArray: Array<string> = ['one', 'two', 'three']; How can I check in TypeScript whether the channelArray contains a string 'three'? Fix (from the top answer): The same as in JavaScript, using Array.prototype.indexOf() : console.log(channelArray.indexOf('three') > -1); Or using ECMAScript 2016 Array.prototype.includes() : console.log(channelArray.includes('three')); Note that you could also use methods like showed by @Nitzan to find a string. However you wouldn't usually do…
