Includes Method for String and Array
Includes Methods for String
Here “sentence” is a string. I am using the includes method. Actually includes methods is a method that searches a particular word in the main string(Ex: sentence string, Line no : 3). It gives only Boolean value. The value is “True” or “False”
If The word matches the main string then it gives a true value(Ex: Line.No: 6) or not matches it gives a false value(Ex: Line.No:7). The main String in not changes(Ex: Line.No: 8).
Includes methods for Array:
This is similar to the string includes method. If property dose does not match with the main array(fruits array) then return false value(Ex: Line.No: 18). And If property matches with the main array(fruits array) then return a true value.
The main array does not change