How to check if string contains specific character in TypeScript

1 Answer

0 votes
const str = 'typescript c c++';
const ch = 's';

console.log(str.includes(ch)); 
console.log(str.includes('T')); 




/*
run:

true
false

*/

 



answered Feb 6, 2022 by avibootz
edited Feb 6, 2022 by avibootz
...