Generally it compares two string and returns true if string contains the specific string otherwise it returns false. It also returns true if some of part completely matches the string.
=> includes(value, position)
let str = "my name is rakesh saini" let result = str.includes("rak"); Answer: true
We can also provide the starting position from there start searching in the includes() function in the second position. See the example below: It will search from the 44th position. rakesh comes before the 44th position so it will return false.
let str = "my name is rakesh saini" let result = str.includes("rak", 44); Answer: false
Please visit more Useful Tutorials.