EN
JavaScript - String includes() method example
0 points
xxxxxxxxxx
1
const text = 'ABCDE';
2
3
console.log(text.includes('A')); // true
4
console.log(text.includes('X')); // false
5
6
console.log(text.includes('B')); // true
7
console.log(text.includes('B', 2)); // false
8
9
console.log(text.includes('ABC')); // true
10
console.log(text.includes('XYZ')); // false
Syntax |
|
Parameters |
|
Result | The method returns true if the searchString is found anywhere within the given string, otherwise returns false . |
Description | This method lets you determine whether or not a string includes another string. |