Determining if a string is contained in another string

includes (): returns a Boolean value that indicates whether to find a parameter string. 
startsWith (): returns a Boolean value indicating whether the parameter string at the head of the original string. 
endsWith (): returns a Boolean value indicating whether the parameter string at the end of the original string. 
S the let = 'the Hello World!' ; 

s.startswith ( 'the Hello') // to true 
s.endsWith ( '!') // to true 
s.includes ( 'O') // to true

 endsWithThe behavior of the other two methods are different. It is for the previous ncharacters, while the other two methods for from the first nend position until a string

Guess you like

Origin www.cnblogs.com/hzx-5/p/11489955.html