JavaScript strings methods are used to perform various operations on string.
The indexOf() method returns the index (position) of the first occurrence of a string in a string.
The lastIndexOf() method returns the index (position) of the last occurrence of a string in a string.
Both indexOf() and lastIndexOf() return -1 if the text is not found.
Both methods accept a second parameter as the starting position for the search.
The lastIndexOf() methods searches backwards (from the end to the beginning), meaning: if the second parameter is 15, the search starts at position 15, and searches to the beginning of the string.
The search() method searches a string for a string (or a regular expression) and returns the position of the match. It is similar to indexOf() except it does not have a start value.
The match() method returns an array containing the results of matching a string against a string (or a regular expression).
The matchAll() method returns an iterator containing the results of matching a string against a string (or a regular expression).
The includes() method returns true if a string contains a specified value. Otherwise it returns false.
The startsWith() method returns true if a string begins with a specified value. Otherwise it returns false.
The endsWith() method returns true if a string ends with a specified value. Otherwise it returns false.
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved