String
String Quotes
Strings can be enclosed within either single quotes, double quotes.Backtick quotes
- process expression
- process function
- multi line
Special characters
Accessing characters
Notes:The only difference between them is that if no character is found, [] returns undefined, and charAt returns an empty string.
iterate character by character
String length
Changing the case
Searching for a substring
str.indexOf
- returns the position where the match was found
- -1 if nothing can be found.
str.lastIndexOf(substr, position)
There is also a similar method str.lastIndexOf(substr, position) that searches from the end of a string to its beginning. It would list the occurrences in the reverse order.
No comments:
Post a Comment