19.Matching the Ending of the String endsWith() Method includes Method in JavaScript

preview_player
Показать описание
By the end of this video you will be able to

1.Match the ending the String PATTERN MATCHING
2. Check any part in any other string

facebook

instagram

The endsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.

Syntax
Section

Parameters
Section

searchString
The characters to be searched for at the end of this string.
length
Optional. If provided it is used as the length of str. If omitted, the default value is the length of the string.

Return value
Section

true if the given characters are found at the end of the string; otherwise, false

This method lets you determine whether or not a string ends with another string. This method is case-sensitive

The includes() method determines whether one string may be found within another string, returning true or false as appropriate.

Syntax
Section

Parameters
Section

searchString
A string to be searched for within this string.
position Optional
The position within the string at which to begin searching for searchString. (defaults to 0).

Return value
Section

true if the search string is found anywhere within the given string; otherwise, false if notSyntax
Section

Parameters
Section

searchString
A string to be searched for within this string.
position Optional
The position within the string at which to begin searching for searchString. (defaults to 0).

Return value
Section

true if the search string is found anywhere within the given string; otherwise, false if not

This method lets you determine whether or not a string includes another string.
Case-sensitivity
Section

The includes() method is case sensitive. For example, the following expression returns false:

'Blue Whale'.includes('blue'); // returns fals

19 Matching the Ending of the String endsWith Method includes Method in JavaScript
Рекомендации по теме
join shbcf.ru