JavaScript String search() Method - JavaScript Methods for Searching Strings
JavaScript String Search
- JavaScript Search Methods :
- String indexOf()
- String lastIndexOf()
- String search()
- String match()
- String matchAll()
- String includes()
- String startsWith()
- String endsWith()
- JavaScript Search Methods and definition :
- The indexOf() method returns the index of (position of) the first occurrence of a string in a string
- The lastIndexOf() method returns the index of the last occurrence of a specified text in a string
- The search() method searches a string for a string (or a regular expression) and returns the position of the match
- 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