Home >Web Front-end >JS Tutorial >A brief discussion on common methods of String objects in JavaScript_javascript skills
The methods provided by the String object are used to process strings and characters.
Some commonly used methods:
charAt(index): Returns the character at index in the string.
indexOf(searchValue,[fromIndex]): This method looks for the first occurrence of searchValue in the string. If fromIndex is given, the search starts from this position within the string. When searchValue is found, the position of the first character of the string is returned.
lastIndexOf(searchValue,[fromIndex]): Searches searchValue forward from the end of the string and reports the first instance found.
substring(indexA,indexB): Get the substring from indexA to indexB
toLowerCase(): Convert all characters in the string to lowercase
toUpperCaser(): Convert all characters in the string to uppercase
Have you guys understood the usage of String objects? I hope you like this article.